Closed jhaan21 closed 3 years ago
Perhaps post the full request/response, including headers.
This is all done programmatically with their java sp-api so after the call is created using the "buildcall()" method I can't deconstruct it to its actual json but this is what I can get from the debugger
Request{method=POST, url=https://sellingpartnerapi-na.amazon.com/feeds/2020-09-04/documents, tag=Request{method=POST, url=https://sellingpartnerapi-na.amazon.com/feeds/2020-09-04/documents, tag=null}} Request Headers with removed security: User-Agent: Swagger-Codegen/1.0.0/java x-amz-access-token: X-Amz-Security-Token: Host: sellingpartnerapi-na.amazon.com X-Amz-Date: 20210127T202354Z Authorization: AWS4-HMAC-SHA256 Credential=/20210127/us-east-1/execute-api/aws4_request, SignedHeaders=content-type;host;user-agent;x-amz-access-token;x-amz-date;x-amz-security-token, Signature= Body before serialization:
{"contentType": "text/tab-separated-values; charset=UTF-8" }
Reponse Info:
Headers: {Date=[Wed, 27 Jan 2021 20:26:58 GMT], Content-Type=[application/json], Content-Length=[663], Connection=[keep-alive], x-amzn-RequestId=[], x-amzn-RateLimit-Limit=[0.0083], x-amz-apigw-id=[], X-Amzn-Trace-Id=[Root=**], OkHttp-Sent-Millis=[1611779327027], OkHttp-Received-Millis=[1611779327251]}
response.getStatusCode() = 201; response.getData() = null;
Again, I can't deconstruct into the json from their ApiResponse object but I'm assuming that the getData should return me the payload with the information I need. Even when I do a simple get request for a product I get a 200 but null in the data
Based off that Content-Length, looks like an issue with your code/SDK, not the API itself, so this bug should probably be closed.
Hi, could you provide me with some insight as to why the content-length makes you believe its the code? I just did a pull and everything is still up-to-date git wise. It very well could be the parameters on the build call method. However, there's no examples I can find using their selling-partner-api-models/clients/sellingpartner-api-aa-java/ sdk.
I create their SellersApi object with their sdk code:
SellersApi sellersApi = new SellersApi.Builder() .awsAuthenticationCredentials(awsAuthenticationCredentials) .lwaAuthorizationCredentials(lwaAuthorizationCredentials) .awsAuthenticationCredentialsProvider(awsAuthenticationCredentialsProvider) .endpoint("https://sellingpartnerapi-na.amazon.com") .build(); Use their sellersApi object to get the ApiClient that was created with the swagger-codegen The ApiClient object comes from "Generating a Java SDK with LWA token exchange and authentication" in https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md
ApiClient client = sellersApi.getApiClient();
I then use that ApiClient, client, to build the call which is also their code
Call call = client.buildCall("/feeds/2020-09-04/documents", "POST", new ArrayList(), new ArrayList(), body, new HashMap(), new HashMap(), auths, null);
I then use their client to make the call to their ApiResponse object which also comes from the swagger-code generation
ApiResponse
So the SDK is the amazon selling-partner-api-models/clients/sellingpartner-api-aa-java/. So if it's something I coded it would be the parameters themselves in client.buildcall(...) and the parameters are wrong or I am missing something or it is a bug. Any insight would be helpful as information on this is hard to come by. I appreciate your time in talking and helping me
It has a body of 663 bytes apparently, you just didn't post it. This github is for issues with the API ITSELF, not issues with connecting to the API.
Hello @jhaan21
Did you manage to get past this error?
Please feel free to open a support case with us if you'd like deeper assistance with this issue.
Thanks, Shivika Khare Selling Partner API Developer Support
@ShivikaK Is there any solution to this closed issue? I'm facing the same problem with SDK receiving empty payloads. Only MarketplaceParticipation works and returns marketplace details. @jhaan21 Have you resolved the issue, could you please let me know?
This ticket was not an API issue. It was an issue with whatever broken client-side code was involved. Questions like this should go on stackoverflow.com or some other forum.
It's about poor documentation and broken SPAPI SDK. The "new" API of multibillion corporation has the worst documentation I have ever seen. Support cases are being left for months or not resolved at all. Developers has no way to go, to ask due to poor documentation. Please consider establishing the solid documentation and support and then require to write on its own threads or whatever. P.S. I don't see you among contributors or maintainers of this repo.
Yes this github is appropriate for reporting documentation issues. Bug amzn/selling-partner-api-models#987 is not a documentation issue, it's just a user that needed advice on writing user code. It's correct that this was closed, as it's not a bug report. Again, see stackoverflow etc for stuff like this.
I'm not associated with Amazon, but I have been trying to help clean up this github by answering questions etc when I can.
Also ran into this problem. Tracing with the debugger revealed that the call to execute
ApiResponse response = client.execute(call);
needs to be the one for the overload that accepts the Type
parameter, like
ApiResponse response = client.execute(call, Class.forName("java.lang.String"));
Then you'll get JSON returned. Hope this helps.
Hi,
I am trying to create a document feed using the createDocumentFeed following these steps:
https://github.com/amzn/selling-partner-api-docs/blob/main/guides/use-case-guides/feeds-api-use-case-guide-2020-09-04.md#step-1-create-a-feed-document
I am getting a 201 which is the correct response. However, I am not getting a payload back at all which would have the IDs needed to continue.
Here is the code for the call and the response info for the 201:
String body = "{\"contentType\": \"text/tab-separated-values; charset=UTF-8\"}";
Call call = client.buildCall("/feeds/2020-09-04/documents", "POST", new ArrayList(), new ArrayList(), body, new HashMap(), new HashMap(), auths, null);
ApiResponse response = client.execute(call);
Response for the call code: 201 Response for the call data: null
I've seen a few other people getting null/empty payloads but no one has appeared to provide the answer on how to fix this. Anyone have insight or can provide me with what I am missing?
Thanks