NAVNavbar
Logo
php python csharp java

Get Amazon ASIN Results by id

 
This endpoint will provide you with information about the product and ASINs of all its modifications listed on Amazon.

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-dashboard

<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-dashboard
$client = new RestClient($api_url, null, 'login', 'password');

try {
   $result = array();
   // #1 - using this method you can get a list of completed tasks
   // GET /v3/merchant/amazon/asin/tasks_ready
   $tasks_ready = $client->get('/v3/merchant/amazon/asin/tasks_ready');
   // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
   if (isset($tasks_ready['status_code']) AND $tasks_ready['status_code'] === 20000) {
      foreach ($tasks_ready['tasks'] as $task) {
         if (isset($task['result'])) {
            foreach ($task['result'] as $task_ready) {
               // #2 - using this method you can get results of each completed task
               // GET /v3/merchant/amazon/asin/task_get/advanced/$id
               if (isset($task_ready['endpoint_advanced'])) {
                  $result[] = $client->get($task_ready['endpoint_advanced']);
               }
               // #3 - another way to get the task results by id
               // GET /v3/merchant/amazon/asin/task_get/advanced/$id
               /*
               if (isset($task_ready['id'])) {
                  $result[] = $client->get('/v3/merchant/amazon/asin/task_get/advanced/' . $task_ready['id']);
               }
               */
            }
         }
      }
   }
   print_r($result);
   // do something with result
} catch (RestClientException $e) {
   echo "\n";
   print "HTTP code: {$e->getHttpCode()}\n";
   print "Error code: {$e->getCode()}\n";
   print "Message: {$e->getMessage()}\n";
   print  $e->getTraceAsString();
   echo "\n";
}
$client = null;
?>

The above command returns JSON structured like this:

{
    "version": "0.1.20200429",
    "status_code": 20000,
    "status_message": "Ok.",
    "time": "0.0922 sec.",
    "cost": 0,
    "tasks_count": 1,
    "tasks_error": 0,
    "tasks": [
        {
            "id": "05061154-1535-0192-0000-1605e1a44f0b",
            "status_code": 20000,
            "status_message": "Ok.",
            "time": "0.0251 sec.",
            "cost": 0,
            "result_count": 1,
            "path": [
                "v3",
                "merchant",
                "amazon",
                "asin",
                "task_get",
                "advanced",
                "05061154-1535-0192-0000-1605e1a44f0b"
            ],
            "data": {
                "se_type": "shopping",
                "api": "merchant",
                "function": "asin",
                "se": "amazon",
                "priority": 2,
                "language_code": "en_US",
                "location_code": 9001634,
                "asin": "B07J2Z5DBM",
                "device": "desktop",
                "os": "windows"
            },
            "result": [
                {
                    "asin": "B07J2Z5DBM",
                    "type": "shopping",
                    "se_domain": "amazon.com",
                    "location_code": 9001634,
                    "language_code": "en_US",
                    "check_url": "https://www.amazon.com/dp/B07J2Z5DBM?language=en_US",
                    "datetime": "2020-05-06 08:54:32 +00:00",
                    "item_types": [
                        "amazon_product_info"
                    ],
                    "items_count": 1,
                    "items": [
                        {
                            "type": "amazon_product_info",
                            "rank_group": 1,
                            "rank_absolute": 1,
                            "position": "left",
                            "xpath": "/#document",
                            "title": "TOZO T10 Bluetooth 5.0 Wireless Earbuds with Wireless Charging Case IPX8 Waterproof TWS Stereo Headphones in Ear Built in Mic Headset Premium Sound with Deep Bass for Sport Black",
                            "details": "Product Dimensions 1 x 1 x 0.7 inches\nItem Weight 0.16 ounces\nShipping Weight 7.2 ounces ( View shipping rates and policies )\nDepartment all\nManufacturer TOZO\nASIN B07J2Z5DBM\nItem model number 4353513035\nBatteries 1 Nonstandard Battery batteries required. (included)\nCustomer Reviews /*\n* Fix for UDP-1061. Average customer reviews has a small extra line on hover\n* https://omni-grok.amazon.com/xref/src/appgroup/websiteTemplates/retail/SoftlinesDetailPageAssets/udp-intl-lock/src/legacy.css?indexName=WebsiteTemplates#40\n*/\n.noUnderline a:hover {\ntext-decoration: none;\n}\n4.3 out of 5 stars\nBest Sellers Rank #5 in Earbud & In-Ear Headphones\nDate first listed on Amazon October 5, 2018",
                            "image_url": "https://images-na.ssl-images-amazon.com/images/I/71isyD36rbL._AC_SL1500_.jpg",
                            "author": "TOZO",
                            "data_asin": "B07J2Z5DBM",
                            "parent_asin": "B086DLMPHZ",
                            "product_asins": [
                                "B07J2Z5DBM",
                                "B07VT7DD48",
                                "B07VSGLBLZ",
                                "B07RP6NF5J",
                                "B07VQ82393"
                            ],
                            "price_from": 39.99,
                            "price_to": null,
                            "currency": "USD",
                            "is_amazon_choice": true,
                            "rating": {
                                "type": "rating_element",
                                "position": "left",
                                "rating_type": "Max5",
                                "value": "4.3",
                                "votes_count": 35052,
                                "rating_max": "5"
                            },
                            "is_newer_model_available": true,
                            "newer_model": {
                                "title": "TOZO T6 True Wireless Earbuds Bluetooth Headphones Touch Control with Wireless Charging Case IPX8 Waterproof TWS Stereo Earphones in-Ear Built-in Mic Headset Premium Deep Bass for Sport Black",
                                "newer_model_asin": "B07RGZ5NKS"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

Description of the fields for sending a request:

Field name Type Description
id string task identifier
unique task identifier in our system in the UUID format
you will be able to use it within 30 days to request the results of the task at any time

‌‌‌‌
‌‌As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

Description of the fields in the results array:

Field name Type Description
version string the current version of the API
status_code integer general status code
you can find the full list of the response codes here
status_message string general informational message
you can find the full list of general informational messages here
time string execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasks array
tasks_error integer the number of tasks in the tasks array that were returned an error
tasks array array of tasks
        id string task identifier
unique task identifier in our system in the UUID format
        status_code integer status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here
        status_message string informational message of the task
you can find the full list of general informational messages here
        time string execution time, seconds
        cost float cost of the task, USD
        result_count integer number of elements in the result array
        path array URL path
        data array contains the same parameters that you specified in the POST request
        result array array of results
            asin string ASIN received in a POST array
the unique product identifier in Amazon (ASIN) received in a POST array
            type string search engine type in a POST array
possible values: shopping
            se_domain string Amazon domain in a POST array
            location_code integer location code in a POST array
            language_code string language code in a POST array
            check_url string direct URL to Amazon results
you can use it to make sure that we provided accurate results
            datetime string date and time when the result was received
in the format: “year-month-date:minutes:UTC_difference_hours:UTC_difference_minutes”
example:
2019-11-15 12:57:46 +00:00
            spell array autocorrection of the search engine
if the search engine provided results for a keyword that was corrected, we will specify the keyword corrected by the search engine and the type of autocorrection
            item_types array types of search results found on Amazon
contains types of all search results (items) found in the returned SERP
possible item types:
amazon_product_info
            items_count integer the number of results returned in the items array
            items array Amazon product info items
                type string type of element = ‘amazon_product_info’
                rank_group integer position within a group of elements with identical type values
positions of elements with different type values are omitted from rank_group
                rank_absolute integer absolute rank
absolute position among all the elements in the response array
                position string the alignment of the element in Amazon SERP
possible values:
left, right
                xpath string the XPath of the element
                title string product title
                details string product specs and other details
                image_url string the URL of the product image
                author string product brand name
                data_asin string ASIN of the product received in a POST array
                parent_asin string parent ASIN of the product
                product_asins array ASINs of all found product modifications
                price_from float the lower limit of the product price range
example:
49.98
                price_to float the upper limit of the product price range
example:
384.99
                currency string currency in the ISO format
example:
USD
                is_amazon_choice boolean “Amazon’s choice” label
if the value is true, the product is marked with the “Amazon’s choice” label
                rating array product rating info
                    type string type of element = ‘rating_element’
                    position string the alignment of the element in Amazon SERP
possible values:
left, right
                    rating_type string the type of rating
here you can find the following elements: Max5, Percents, CustomMax
                    value string the value of the rating
                    votes_count integer the amount of feedback given to a product
                    rating_max string the maximum value for a rating_type
                is_newer_model_available boolean indicates whether the newer model of the product is available
                newer_model array information about the newer model of the product
                   title string product title
                   newer_model_asin string ASIN of the newer product model

‌‌