amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
590 stars 728 forks source link

searchCatalogItems pageToken error Missing required 'identifiers' or 'keywords' #4178

Closed truonggiang347 closed 2 weeks ago

truonggiang347 commented 3 weeks ago

I am experiencing an issue with the SP API. My first API call to GET /catalog/2022-04-01/items returned over 200 results, along with a nextToken for pagination. I used this nextToken to make a second call in the following format:

https://sellingpartnerapi-na.amazon.com/catalog/2022-04-01/items?marketplaceIds=ATVPDKIKX0DER&pageToken=xxxxxxxxxx However, the second call returns an error message: "Missing required 'identifiers' or 'keywords'."

Could you please clarify if this is the expected behavior or if there is a specific way to handle nextToken when paginating through the results for this endpoint?

jawheral commented 3 weeks ago

Hi @truonggiang347,

After receiving a "pagination.nextToken" in the first response, you should still use the first parameters with the nextToken in the subsequent request. This means if you used an identifiers or keywords value, you should still provide it.

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

truonggiang347 commented 2 weeks ago

Jawher,

I tried that and the result I got is an empty items list. Is this the expected behavior? API1: https://sellingpartnerapi-na.amazon.com/catalog/2022-04-01/items?keywords=a&brandNames=nestle&pageSize=20&marketplaceIds=ATVPDKIKX0DER&includedData=attributes,dimensions,identifiers,images,productTypes,salesRanks,summaries,relationships API2:https://sellingpartnerapi-na.amazon.com/catalog/2022-04-01/items?keywords=a&brandNames=nestle%21&pageSize=20&marketplaceIds=ATVPDKIKX0DER&includedData=attributes,dimensions,identifiers,images,productTypes,salesRanks,summaries,relationships&pageToken=xxxxx

jawheral commented 2 weeks ago

Hi @truonggiang347,

No that is not the expected behavior. I tried the exact requests you shared and the items list is not empty on my side.

The problem is coming from the "%21" that is added in the brand after "nestle" in the second request. Please remove it and it will work as expected.

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

truonggiang347 commented 2 weeks ago

Thanks. That works. Never notice that I put an ! with all the calls.

jawheral commented 2 weeks ago

@truonggiang347 happy this worked for you!