Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make AWS REST API return a JSON instead of XML

In AWS I invoke the call ListQueues on sqs.us-east-2.amazonaws.com (by calling directly to the REST API)

The response is always an XML, and searching in the AWS documentation I couldn't find how to get a JSON.

Any ideas?

like image 759
Eden Avatar asked Jan 26 '23 20:01

Eden


2 Answers

Provide the Accept: application/json header and you'll get a JSON response.

Edit: AWS doesn't have much (any?) documentation on the return types. I made a pip module that documents some of the return types that may be helpful as a reference: https://pypi.org/project/awsxmltojson/

like image 196
seveibar Avatar answered Jan 29 '23 20:01

seveibar


Not possible to get JSON response from SQS available actions. Response will always be XML data structures.

In response to an action request, Amazon SQS returns an XML data structure that contains the results of the request.

Source: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-api-responses.html

like image 36
A.Khan Avatar answered Jan 29 '23 19:01

A.Khan