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
580 stars 730 forks source link

400 Bad Request when using NextToken on listFinancialEventsByOrderId #1172

Closed fernlop closed 2 years ago

fernlop commented 3 years ago

I'm trying to get the next page of financial events on the listFinancialEventsByOrderId (path: /finances/v0/orders/{orderId}/financialEvents ) method, but I receive a bad request error.

What i try:

GET Request on: https://sellingpartnerapi-eu.amazon.com/finances/v0/financialEventGroups/{MyEventGroupId}/financialEvents?NextToken={NextToken}

Response: Data is empty, Code 400, Bad Request

When i try with a Token that is invalid (ANY String) i receive the following:

StatusCode: 200
data: { payload: {} }

Only with the correct NextToken i get the Bad Request error.

This results in 2 problems:

Can someone access the listFinancialEventsByOrderId with NextToken successfully? I would appreciate the feedback.

stefnats commented 3 years ago

Hey @fernlop i didn't try that, but it seems similar to issue amzn/selling-partner-api-models#1148 It basically says that NextToken should be sent as header. Can you try that?

fernlop commented 3 years ago

@stefnats No doesn't work, if I put the NextToken only in the header it continues to give me the first page of results.

fernlop commented 3 years ago

UPDATE: NextToken doesn't work with listFinancialEvents eighter.

ALSO INTERESTING: When using the getOrders method, I can use the NextToken in the QueryParams and it works. Other users like in amzn/selling-partner-api-models#1148 can't use it. I'm on the EU servers, maybe there is some difference? For me it works with NextToken in the QueryParams but not in the header.. /orders/v0/orders/?CreatedAfter=2021-02-01T00:00:00.000Z&CreatedBefore=2021-02-28T00:00:00.000Z&MarketplaceIds=A13V1IB3VIYZZH,A1805IZSGTT6HS,A1F83G8C2ARO7P,A1PA6795UKMFR9,A1RKKUPIHCS9HS,A2NODRKZP88ZB9,APJ6JRA9NG5V4&NextToken=2iqSofqEJZCaJqJYLDm0ZAmQazDrhw3CgJalwszeU.................

stefnats commented 3 years ago

Hm that's interesting. Just out of curiosity, which library are you using for making that call?

fernlop commented 3 years ago

@stefnats I built my own SDK for NodeJS, requests look like this when using it:

const events = await amzSDK.request({
  region: "eu",
  type: "listFinancialEvents",
  queryParams: {
      PostedAfter: (new Date(fromDate)).toISOString(),
      PostedBefore: (new Date(toDate)).toISOString() 
  },
  accessToken: mwsAccountConfig.accessToken,
  iamUserAuth: auth,  
  bottleneckConfig: {
      ...auth.redisAuth
}

The SDK is currently private but I'm open for contributors :)

stefnats commented 3 years ago

I don't have that many ideas left and I think Amazon needs to help out. A quick stupid idea, are you URL encoding the next token and have you tried to base64 encode it?

cgaugel commented 3 years ago

Same problem here. It was working some weeks ago, now I am stuck here as well.. @parvathm fix this!

fernlop commented 3 years ago

@stefnats yes it gets URL encoded and it's already Base64 encoded. @cgaugel Did you open a case for this already? It's their basic excuse if they can't fix it quickly.

cgaugel commented 3 years ago

@fernlop , I just opened a case and submitted a new bug issue here: https://github.com/amzn/selling-partner-api-models/issues/384 because it is regarding another API endpoint than yours.

Hopefully they will fix this asap.

parvathm commented 3 years ago

Hi all,

We are looking into this issue. @fernlop if you have already opened a case with above details please share case id.

Thanks, Parvathm, Selling Partner API Developer Support.

fernlop commented 3 years ago

@parvathm No I didn't create a ticket for this problem yet. Would this help organize the issues for you? Could you provide use a time window for this issue, maybe you already assigned it to a sprint :)

parvathm commented 3 years ago

Hi @fernlop,

Yes, if open a case and provide us request id, time stamp and any relevant data for which you are receiving error it helps us to identify the issue quickly and come up with ETA.

Thanks, Parvathm Selling Partner API Developer Support.

cgaugel commented 3 years ago

Still not fixed.

ShivikaK commented 3 years ago

Hello,

The code changes for this issue have been deployed. Can you please try making the request with NextToken and let us know if the issue is resolved?

Thanks, Shivika Khare, Selling Partner API Developer Support.

github-actions[bot] commented 2 years ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.