1

I have created an api in amazon api gateway service with s3 proxy, and created a method post to upload a file to s3 using the document. Deployed the API and then using that url i tried to call the api from postman. But i couldn't post the file and it returns an error 'missing authentication token'.

I set authorization as NONE.

Then it returns an Unexpected "<" error.

Sabreena
  • 619
  • 2
  • 11
  • 25

2 Answers2

2

Ah, okay. S3 only supports POST from an HTML form, which is why you see the error where it is expecting multipart formdata.

The method you need to use is PUT, instead of POST. PUT requires an item path, so you'll need to change the resource path to have a bucket and key, or get those from other places.

I have some more info on how to set this up in upload binary from api gateway to S3 bucket

Community
  • 1
  • 1
Mark Mucha
  • 1,560
  • 2
  • 12
  • 18
  • Thanks Mark , Can i send x-amz-tagging along with this? – Sabreena Apr 11 '17 at 05:52
  • Yes, you can pass x-amz-tagging with your S3 object. Here is an example of a Swagger def where x-amz-acl is passed to S3: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-as-s3-proxy-export-swagger-with-extensions.html – Mark Mucha Apr 11 '17 at 06:10
  • i need to send the tags from client side along with the audio ,now the audio is successfully uploading to s3 ,but the tags i am sending is not present in the tags field of that object – Sabreena Apr 11 '17 at 08:11
  • Hi Mark, created a question , http://stackoverflow.com/questions/43341378/couldnt-get-the-x-amz-tagging-value-from-api-gateway-to-s3 – Sabreena Apr 11 '17 at 09:57
1

It sounds like the document you're uploading isn't JSON. By default, API Gateway expects UTF-8 encoded JSON.

What content type are you sending with your Postman request?

Mark Mucha
  • 1,560
  • 2
  • 12
  • 18