Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request is invalid - NextToken must not be empty #607

Open
mtarique opened this issue Aug 25, 2023 · 5 comments
Open

Request is invalid - NextToken must not be empty #607

mtarique opened this issue Aug 25, 2023 · 5 comments

Comments

@mtarique
Copy link

Problem description: I am receiving a next token but when calling api with next token it gives me below error [400] { "errors": [ { "code": "InvalidInput", "message": "Request is invalid - NextToken must not be empty", "details": "" } ] }

Error:[400] { "errors": [ { "code": "InvalidInput", "message": "Request is invalid - NextToken must not be empty", "details": "" } ] }

# Your error here. PLEASE make sure to redact secrets from your error log!

Code

$api = new SellingPartnerApi\Api\FbaInboundV0Api($config);

$resNextToken = $api->getShipments('NEXT_TOKEN', ['NextToken' => $nextToken]);

Seller Central SP API config page screenshot

your screenshot here

@DomuITteam
Copy link

Looking at the documentation, you still need query_type and marketplace_id in your request, as these are non-optional. So your code might need to look like this:

$resNextToken = $api->getShipments($query_type, $marketplace_id, $shipment_status_list, $shipment_id_list, $last_updated_after, $last_updated_before, $next_token);

If you don't need to pass other optional parameters, then:

$resNextToken = $api->getShipments($query_type, $marketplace_id, '', '', '', '', $next_token);

@mtarique
Copy link
Author

Hi @DomuITteam,

Thanks for your response.

But when I am including these params it returns same shipments twice

We don't have next pages still receiving next token which contains empty next page.

@DomuITteam
Copy link

To start with, check if the payload from getShipments contains NextToken value, and if so, if it's empty or not.

If both are true, try this instead:

$next_token = $payload->NextToken;
$resNextToken = $api->getShipments(NEXT_TOKEN, $marketplace_id, '', '', '', '', $next_token);

@mtarique
Copy link
Author

Yes payload contains next token and its not empty but the issue is when I am making next request with next token it returns all the results similar to original one. Which makes the final list duplicate for each shipment.

@MuhammadDanyal
Copy link

Yes payload contains next token and its not empty but the issue is when I am making next request with next token it returns all the results similar to original one. Which makes the final list duplicate for each shipment.

Were you able to solve this problem? I am getting the same problem with next token. getting the same data with the next request using next token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants