question

DENG, Nan avatar image
DENG, Nan asked

Documentation (possible) error

Hi, I am working on to integrate ADM into my app. I noticed there are several unclear/error points in the document: 1. Charset in the Content-Type field In section Requesting an Access Token: https://developer.amazon.com/sdk/adm/token.html, subsection Request Format. The example request has a header field: "Content-Type: application/x-www-form-urlencoded;charset=UTF-8". Notice that it specifies the charset. However, in reality, if I specify charset, I will get a response with status code 400. (Although the rest of the document didn't mention the charset, but this example is misleading.) 2. Response Format on error In section Requesting an Access Token: https://developer.amazon.com/sdk/adm/token.html, subsection Response Format. It says: [i]In the case of a non-200 code, the response message may contain the following parameter in the body of the JSONObject: reason: The reason the request was not accepted.[/i] However, the actuall response I got is something like this: {"error": "INVALID_SCOPE", "error_description": "whatever"}
amazon device messaging
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi DENG, Thank you for your post. I agree with your 2nd point. We will correct it in the documentation. But I verified the charset=UTF-8 header, and actually the request works with or without charset defined in header. If you are getting 400 after specifying this header can you please see what is the error and error_description you are receiving in returned json object?
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DENG, Nan avatar image
DENG, Nan answered
Well. Then this is weird. My code can correctly run without specifying charset. But once I specified it, I got the following message: status code: 400 error: INVALID_REQUEST error_description: The Content-Type is not supported by the authorization server Here is the Content-Type header: application/x-www-form-urlencoded;charset=UTF-8 I sent the request to get the token, but failed. Anyway, I can push notification without specifying the charset. So it won't hurt.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi DENG, What technology you are using in the back end to send the requests?
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
For the various flows, the ErrorCodes section describes all the errors that the API can vend out. All the errors will be in the format as in the sample error response.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.