Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3 response in JSON?

Tags:

json

amazon-s3

According to the doc http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGET.html the S3 service seems to respond in XML.

Is there a way to get it in JSON format instead?

like image 549
ajsie Avatar asked Feb 05 '12 22:02

ajsie


People also ask

Does S3 support JSON?

Amazon S3 Select works on objects stored in CSV, JSON, or Apache Parquet format. It also works with objects that are compressed with GZIP or BZIP2 (for CSV and JSON objects only), and server-side encrypted objects.

What does S3 Getobject return?

PDF. Retrieves objects from Amazon S3. To use GET , you must have READ access to the object. If you grant READ access to the anonymous user, you can return the object without using an authorization header.

When working with S3 through the API you get an error response as 409 conflict What could be the reason for this?

You are working with the S3 API and receive an error: 409 Conflict. What is a possible cause of this error? You're attempting to delete a bucket without first removing the contents in the bucket. Explanation: A 409 HTTP Status Code can indicate a BucketNotEmpty error code.


1 Answers

No.

Also the response is not always valid XML! This is a known bug in S3. In S3 you can use any UTF-8 string as a key for an object, including ones with XML invalid characters (<, > etc are fine) but some weird control characters are NOT.

So if somehow you get a file up on S3 with a weird enough string as a key, asking for a listing of that will return invalid XML!

So perhaps they could fix this bug by making some sort of JSON return as an option, but don't look for it soon. The XML bug has been known for years. https://forums.aws.amazon.com/thread.jspa?threadID=10869 https://forums.aws.amazon.com/thread.jspa?threadID=82485

Another sore point is that its impossible (at least when I tried a year ago) to get the XML response gzipped. So you waste lots of bandwidth transmitting very fluffy XML.

It's time for S3 to support a new returned data format that is compressed and robust.

like image 85
Tom Andersen Avatar answered Sep 18 '22 18:09

Tom Andersen