question

kwiltapp avatar image
kwiltapp asked

Body parameters in the changes API get SerializationException

Hi! I would like to use the changes API ( https://developer.amazon.com/public/apis/experience/cloud-drive/content/changes) in the app I am developing. My app has read permissions and access to images. I can call the changes API with no parameters and get a lovely 200 response including a body containing a checkpoint value. curl -v -X POST " https://cdws.us-east-1.amazonaws.com/drive/v1/changes" --header "Authorization: Bearer " --compressed Returns: {"reset":true,"checkpoint":" ","nodes":[...],"statusCode":200} When I try to pass the checkpoint in the subsequent call: curl -v -X POST "https://cdws.us-east-1.amazonaws.com/drive/v1/changes" --header "Authorization: Bearer " --compressed --data "checkpoint= " I get response HTTP/1.1 400 Bad Request x-amzn-RequestId: dfb8cdde-c0ed-11e4-945c-8d0e8b6e7be8 x-amzn-ErrorType: SerializationException:http://internal.amazon.com/coral/com.amazon.coral.service/ {"Message":null} The 400 error, SerializationException, and {"Message":null} response persist in each of my attempts to pass the various body params to the changes API (chunkSize, maxNodes, includePurged). It is possible that I am missing something obvious and failing to properly send POST body parameters, though I managed to send them during the server-side authorization process. It is my hope that I am sane but I would welcome any advice or correction to my attempts. Thanks very much! Kwilt App
amazon drive
10 |5000

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

Sean Callahan avatar image
Sean Callahan answered
Thank you for your post. We’re expecting the body to be passed as a JSON. Your request looks like: POST /drive/v1/changes HTTP/1.1 Host: drive.amazonaws.com Authorization: Bearer Content-Type: application/x-www-form-urlencoded checkpoint= The correct request: POST /drive/v1/changes HTTP/1.1 Host: drive.amazonaws.com Authorization: Bearer {"checkpoint":"CNWwq72RKRoA”} Please let us know if you have any questions.
10 |5000

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

kwiltapp avatar image
kwiltapp answered
Thanks very much! The request curl -v -X POST " https://cdws.us-east-1.amazonaws.com/drive/v1/changes" --header "Authorization: Bearer " --compressed --data "{\"checkpoint\":\"CK3O2cCyKRoA\"}" worked as expected!
10 |5000

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