Upload to S3 not working, documentation unclear

434 views
Skip to first unread message

mi...@generalpie.com

unread,
Dec 5, 2017, 6:16:17 PM12/5/17
to Eventbrite API
Been struggling with this for 2 days and completely out of options
Using PHP

No matter what I do I can't seem to get s3 to accept my multipart upload. I don't know what the structure is supposed to be and the EB documentation isn't much help and it's getting extremely frustrating.

Anyway, using the returned upload data as query parameters in a multipart request results in s3 complaining that 'key' doesn't exist. Changing 'key' to 'Key' makes this error go away (helpful that the error message is in lower case), however I then get that I'm getting conflicting query parameters, acl and policy. Unfortunately there is zero documentation on this error message - only some people suggesting that I put an enctype in the form.

I'm not using a form, however I have added the Content-Type of the file to the multipart array, and Guzzle automatically adds the multipart/form-encoded header to the request. However this has made no difference. I simply can't figure out how to structure the parameters for this request. I've tried every possible way - and now I have no idea if this is a problem with the s3 signed object I'm getting back or my code.

For more information this stack over flow question has some of the things I have tried.
https://stackoverflow.com/questions/47644875/struggling-with-s3-multipart-upload-guzzle-for-eventbrite

There is an existing question that gives a pretty specific curl example, but I can't get that working and don't get any errors at all from curl, so I'm not using it .

Malina Wiesen

unread,
Dec 12, 2017, 1:23:59 PM12/12/17
to Eventbrite API
Hi Mike,

Here is a link to a gist of a PHP sample that I wrote for you. It successfully uploads the image to S3. It wasn't straightforward for me to figure out and I am passing that feedback on to one of Product Managers. I got the same error you got and then found this on Stack Overflow: https://stackoverflow.com/questions/15234496/upload-directly-to-amazon-s3-using-ajax

Once I passed the key in before the file field, it worked. 


Apologies for the frustration here and I hope this helps clear things up for you!

mi...@generalpie.com

unread,
Dec 12, 2017, 6:05:13 PM12/12/17
to Eventbrite API
Hi Malina, thanks for this I'll have a go.

Unfortunately the upload to S3 isn't the only problem I'm having with the API. I've been using a curl request to push the image to s3, but I don't get an error from Curl, I get nothing back so I have no idea if it worked, I will try your method tho I'm interested in why a guzzle multipart request can't achieve the same thing.

However when I then make a POST request to the media/upload endpoint with the upload_token I get the errors "Unknown parameter 'upload_token', 'type' parameter required"


I'm starting to think there is actually something wrong with the eventbrite API. As making a post request to /events/:id/publish results in
Client error: `POST https://www.eventbriteapi.com/v3/events/41196054508/publish` resulted in a `405 METHOD NOT ALLOWED` response:
{"status_code": 405, "error_description": "That HTTP method is not valid on this endpoint.", "error": "METHOD_NOT_ALLOWE (truncated...).


The response from /media/upload to a POST request also seems to suggest it thinks it is receiving a GET request (hence asking for type)

I also cannot update an event, it just retrieves the event from the ID and ignores the updated parameters, the response you would expect from a GET request. It creates a new event just fine, when sending a POST to /events, so it must be working in SOME way. It is confusing that there would be some difference between POST /events and POST /events/:id


I am 100% sending a POST request through guzzle, if I xdebug the request object the method is POST. The error message also tells me it's POST. If I send it through POSTMAN I still get the same error. I've tried json_encoding the params into the body, and sending as form_params, and sending as multipart, but the response from the API is inconsistent with what I would expect, the most telling being the 405 error for publish.

mi...@generalpie.com

unread,
Mar 26, 2018, 6:37:56 PM3/26/18
to Eventbrite API
Hi Malina, sorry for the delay in getting back to you.

So, the issue turned out to be omitting trailing slashes. This is something I think Eventbrite should change imo, as recommended in rule No.1 here.

http://blog.restcase.com/7-rules-for-rest-api-uri-design/

Reply all
Reply to author
Forward
0 new messages