Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

GetOrders Pagination error: InvalidInput #13

Open
hetkpatel opened this issue Apr 27, 2022 · 0 comments
Open

GetOrders Pagination error: InvalidInput #13

hetkpatel opened this issue Apr 27, 2022 · 0 comments

Comments

@hetkpatel
Copy link

Able to fetch the first 100 orders when running /orders/v0/orders. However, I receive the following error when I try to use the NextToken param to fetch the next pagination of orders:

{
"errors": [
      {
        "code": "InvalidInput",
        "message": "We could not decode your NextToken. Possible reasons include: a transmission error, improper quoting or a truncation problem.",
        "details": ""
      }
    ]
}

Here is the GET request I am using to get the next set of orders:

auth = AWS4Auth(AccessKeyId, SecretAccessKey, 'us-east-1', 'execute-api', session_token=SessionToken)
headers = {'content-type': 'application/x-www-form-urlencoded','Accept': 'application/json','x-amz-access-token':access_token}
params = {'MarketplaceIds': marketplaceId, 'NextToken': 'J3%2FldqIwXEKaJqJYLDm0ZAmQaz......YSMji4wF0IiRkRQPq0Hy%2BPFdKaQ%3D%3D'}

ordersResponse = requests.get("https://sellingpartnerapi-na.amazon.com/orders/v0/orders", params=params, headers=headers, auth=auth)

I have read other issue regarding NextToken + GetOrders and have tried the following:

  • Changed content-type from application/json to application/x-www-form-urlencoded in the header
  • Used encodeuricomponent() to encode the NextToken before adding it to the params list
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant