I'm encountering this annoying problem on Amazon's SP-API and its orders endpoint.
If I issue the sequent request:
https://sellingpartnerapi-eu.amazon.com/orders/v0/orders?MarketplaceIds=APJ6JRA9NG5V4&CreatedAfter=2021-03-01T00:00:00Z
I get the list of orders correctly, plus an additional, non-empty, field NextToken (which looks to be a base64 value):
{
"payload": {
"NextToken": "uLjySajlaBiaJqJYLDm0ZAmQazDrhw3CG1FJoDI1yzBUojdU4H46tsNI3HOI22PIxqXyQLkGMBs8VhF73Xgy+8ELbjnH8JQbw6wX5xiBJhyriSyQ7nsp20ySLLlBhTgvInTAy+XKVmRZBY+oaVuyc8QON+K1yc/Yt7kFSVBE95CdhRjq3crm1Mpe5xG0Blzcf2GLmUGyr9UGnxD0RJmrryegoU0IPZxXEM3PO3ipBZMfEJoEzZG6nXmssuEKQdDSMBO/reDY2s8epq+YYAk2AASk7RoO0Pg77YYXwRo+g8JiIXlRXylzxduZ3sLNMwtczEceQ+CtWMtAjbTFqrqX3UrzH1AqdxGeK++WzRQP+VFSZ/VYpjb2C0Ejd2syVxEcEw7io0mrdLAUwKwuhfytShM/3HXYSMjikIpa1fhf+aKDuvqjLOyRtg==",
"CreatedBefore": "2021-04-28T09:10:09Z",
"Orders": [
{
"AmazonOrderId": "...........",
"PurchaseDate": "............",
.....
According to the documentation, I just have to make a subsequent call similar to the previous, plus the aforementioned NextToken param (no alterations needed).
So this is what the next call should look like:
https://sellingpartnerapi-eu.amazon.com/orders/v0/orders?MarketplaceIds=APJ6JRA9NG5V4&CreatedAfter=2021-03-01T00:00:00Z&NextToken=uLjySajlaBiaJqJYLDm0ZAmQazDrhw3CG1FJoDI1yzBUojdU4H46tsNI3HOI22PIxqXyQLkGMBs8VhF73Xgy+8ELbjnH8JQbw6wX5xiBJhyriSyQ7nsp20ySLLlBhTgvInTAy+XKVmRZBY+oaVuyc8QON+K1yc/Yt7kFSVBE95CdhRjq3crm1Mpe5xG0Blzcf2GLmUGyr9UGnxD0RJmrryegoU0IPZxXEM3PO3ipBZMfEJoEzZG6nXmssuEKQdDSMBO/reDY2s8epq+YYAk2AASk7RoO0Pg77YYXwRo+g8JiIXlRXylzxduZ3sLNMwtczEceQ+CtWMtAjbTFqrqX3UrzH1AqdxGeK++WzRQP+VFSZ/VYpjb2C0Ejd2syVxEcEw7io0mrdLAUwKwuhfytShM/3HXYSMjikIpa1fhf+aKDuvqjLOyRtg==
But then I get this error:
{
"errors": [
{
"message": null,
"code": "InvalidInput"
}
]
}
Please note I'm using Postman to make the request.
I've already tried to remove all the unnecessary params, leaving only MarketplaceIds (required) and NextToken, to no avail.
What am I doing wrong here? Thanks in advance
I found the solution.
string encodedNextToken = HttpUtility.UrlEncode(nextToken);
Then, pass the encodedNextToken as nexttoken.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With