Product Details
This guide will help developers to retrieve details about an individual product on an Amazon Business marketplace.
Prerequisites
To follow this tutorial, you will need:
- A Storefront installation with a properly configured connection to Amazon Business as described in the Setup guide.
- A process of creating access tokens as described in the Authorization guide.
Retrieving Product Details
Once we have results from a response of the Search API, we can retrieve all details of a product by means of the Product Details API. Technically, it's similar to how we execute a search: It's just a different endpoint and different request and response schema.
Again, we will use an access token (i.e. YOUR_ACCESS_TOKEN). You will need
to pick up the id passed as part of a previous search result (e.g.
s_CgpCMDdaUEtONllSEAIaAlVTIgVlbi1VUyjChT0 if you're following the
example from the search guide):
...
{
"id": "s_CgpCMDdaUEtONllSEAIaAlVTIgVlbi1VUyjChT0",
"provider": "amazon",
"sku": "B07ZPKN6YR",
"name": "Apple iPhone 11, 64GB, Black - Unlocked (Renewed)",
...
},
...
We'll use YOUR_RESULT_ID as a placeholder in the following code snippets:
- cURL
- JavaScript
- C#
- Java
- Go
curl --request GET \
--header 'authorization: YOUR_ACCESS_TOKEN' \
--url 'https://YOUR_DOMAIN/api/v1/amazon/products/YOUR_PRODUCT_ID'
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://YOUR_DOMAIN/api/v1/amazon/products/YOUR_PRODUCT_ID',
headers: {
'content-type': 'application/json',
'authorization': 'bearer YOUR_ACCESS_TOKEN'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
var client = new RestClient("https://YOUR_DOMAIN/api/v1/amazon/products/YOUR_PRODUCT_ID");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "bearer YOUR_ACCESS_TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.post("https://YOUR_DOMAIN/api/v1/amazon/products/YOUR_PRODUCT_ID")
.header("content-type", "application/json")
.header("authorization", "bearer YOUR_ACCESS_TOKEN")
.asString();
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
// Configure your URL
url := "https://YOUR_DOMAIN"
// Prepare HTTP request
req, err := http.NewRequest("GET", baseURL+"/api/v1/amazon/products/YOUR_PRODUCT_ID", http.NoBody)
if err != nil {
panic(err)
}
req.Header.Set("content-type", "application/json")
req.Header.Set("authorization", "bearer "+YOUR_ACCESS_TOKEN)
// Execute the request
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
// The HTTP response body will return JSON accordingly
body, err := io.ReadAll(req.Body)
if err != nil {
panic(err)
}
fmt.Println(resp)
fmt.Println(string(body))
}
Parameters
None.
Response
If everything goes well, you will get a successful HTTP response with
status 200 OK and a payload containing the product details.
{
"id": "s_CgpCMDdaUEtONllSEAIaAlVTIgVlbi1VUyjChT0",
"provider": "amazon",
"name": "Apple iPhone 11, 64GB, Black - Unlocked (Renewed)",
"offersCount": 4,
"taxonomies": [
...
],
"images": [
...
],
"offers": [
{
"id": "kBVluNB7",
"productId": "s_CgpCMDdaUEtONllSEAIaAlVTIgVlbi1VUyjChT0",
"provider": "amazon",
"price": {
"amount": 364,
"currency": "USD",
"formatted": "$ 364.00"
},
...
},
...
],
...
}
If you want to dig into the details of the response structure, please look into the API reference and/or the Swagger/OpenAPI specification.
Errors
In case of an error, you can use the HTTP status code and the response body to find out what went wrong.
Example:
{
"error": {
"code": 404,
"message": "Product not found."
}
}