products
Version 2024-04-01
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
Overview
Returns multiple products from catalog system
Required scope(s)
View & Edit Catalog Data
Response
Return type ProductConnection
Arguments
Argument | Description |
---|---|
after (String) | Takes an optional cursor String for forward pagination along with first index. The size should be greater than or equal to 0 and less than or equal to 65535. |
filter (ProductsInputFilter) | Identifies an RSQL based filter String. |
first (Int) | Takes an optional non-negative integer for forward pagination along with after cursor. The size should be greater than or equal to 0 and less than or equal to 20. |
Examples
Query List Products With Page Size
Request
query products {
products(first: 1) {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
cursor
node {
id
... on Product {
id
externalId {
value
}
sku {
value
}
amazonSku {
value
marketplaceId
}
asin {
value
marketplaceId
}
offerPrime
productDetailPageUrl
image {
displayReadyUrl
sourceUrl
}
description {
values {
value
locale
}
defaultLocale
}
}
}
}
}
}
Response
{
"data": {
"products": {
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "catalogid#example-id-1",
"endCursor": "catalogid#example-id-1"
},
"edges": [
{
"cursor": "catalogid#example-id-1",
"node": {
"id": "example-id-1",
"externalId": {
"value": "example-external-id-1"
},
"sku": {
"value": "example-sku-1"
},
"amazonSku": {
"marketplaceId": null,
"value": "example-amazonSku-1"
},
"asin": {
"value": "example-asin",
"marketplaceId": "example-marketplace-id"
},
"offerPrime": "true",
"productDetailPageUrl": "https://example.com/products/id1",
"image": {
"displayReadyUrl": "https://example.com/product-image-display.jpeg",
"sourceUrl": "https://example.com/product-image.jpeg"
},
"description": {
"values": [
{
"value": "<p>This is a product description with HTML format support for product 1</p>",
"locale": "en-US"
},
{
"value": "<p>Esta es una descripción del producto con soporte de formato HTML para el producto 1</p>",
"locale": "es-ES"
}
],
"defaultLocale": "en-US"
}
}
}
]
}
}
}
Query List Products Using After
Request
query products {
products(after: "example-productId-1") {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
cursor
node {
id
... on Product {
id
externalId {
value
}
sku {
value
}
amazonSku {
value
marketplaceId
}
asin {
value
marketplaceId
}
offerPrime
productDetailPageUrl
image {
displayReadyUrl
sourceUrl
}
description {
values {
value
locale
}
defaultLocale
}
}
}
}
}
}
Response
{
"data": {
"products": {
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": true,
"startCursor": "catalogid#example-id-2",
"endCursor": "catalogid#example-id-3"
},
"edges": [
{
"cursor": "catalogid#example-id-2",
"node": {
"id": "example-id-2",
"externalId": {
"value": "example-external-id-2"
},
"sku": {
"value": "example-sku-2"
},
"amazonSku": {
"marketplaceId": null,
"value": "example-amazonSku-2"
},
"asin": {
"value": "example-asin",
"marketplaceId": "example-marketplace-id"
},
"offerPrime": true,
"productDetailPageUrl": "https://example.com/products/id2",
"image": {
"displayReadyUrl": "https://example.com/product-image-display.jpeg",
"sourceUrl": "https://example.com/product-image.jpeg"
},
"description": {
"values": [
{
"value": "This is a product description for product 2.",
"locale": "en-US"
}
],
"defaultLocale": "en-US"
}
}
},
{
"cursor": "catalogid#example-id-3",
"node": {
"id": "example-id-3",
"externalId": null,
"sku": {
"value": "example-sku-3"
},
"amazonSku": null,
"offerPrime": false,
"productDetailPageUrl": null,
"image": null,
"description": null
}
}
]
}
}
}
Query List Products Without Conditions
Request
query products {
products {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
cursor
node {
id
... on Product {
id
externalId {
value
}
sku {
value
}
amazonSku {
value
marketplaceId
}
asin {
value
marketplaceId
}
offerPrime
productDetailPageUrl
image {
displayReadyUrl
sourceUrl
}
description {
values {
value
locale
}
defaultLocale
}
}
}
}
}
}
Response
{
"data": {
"products": {
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "catalogid#example-id-1",
"endCursor": "catalogid#example-id-2"
},
"edges": [
{
"cursor": "catalogid#example-id-1",
"node": {
"id": "example-id-1",
"externalId": {
"value": "example-external-id-1"
},
"sku": {
"value": "example-sku-1"
},
"amazonSku": {
"marketplaceId": null,
"value": "example-amazonSku-1"
},
"asin": {
"value": "example-asin",
"marketplaceId": "example-marketplace-id"
},
"offerPrime": "true",
"productDetailPageUrl": "https://example.com/products/id1",
"image": {
"displayReadyUrl": "https://example.com/product-image-display.jpeg",
"sourceUrl": "https://example.com/product-image.jpeg"
},
"description": {
"values": [
{
"value": "This is a plain text description for product 1",
"locale": "en-US"
}
],
"defaultLocale": "en-US"
}
}
},
{
"cursor": "catalogid#example-id-2",
"node": {
"id": "example-id-2",
"externalId": null,
"sku": {
"value": "example-sku-2"
},
"amazonSku": null,
"offerPrime": null,
"productDetailPageUrl": null,
"image": null,
"description": null
}
}
]
}
}
}
Query List Products With Invalid Page Size
Request
query products {
products(first: 21) {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
cursor
node {
id
... on Product {
id
externalId {
value
}
sku {
value
}
amazonSku {
marketplaceId
value
}
asin {
value
marketplaceId
}
offerPrime
productDetailPageUrl
image {
displayReadyUrl
sourceUrl
}
description {
values {
value
locale
}
defaultLocale
}
}
}
}
}
}
Response
{
"errors": [
{
"message": "Input request is not valid, the following issues were encountered: [/products/first must be less than or equal to 20]",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"products"
],
"extensions": {
"classification": {
"type": "ValidationError",
"code": "UnspecifiedError",
"details": {},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": {
"products": null
}
}
Updated 1 day ago