0

I have a POST method in my API which uses multipart encoded form data. I have set up the correct header and data settings so that the mashape web interface generated the following curl:

curl -X POST --include 'https://sslavov-text-analytics-v1.p.mashape.com/news' \
  -H 'Authorization: Basic ***********' \
  -H 'X-Mashape-Key: ************' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@sample.docx' \
  -F 'meta={"documentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"};type=application/json'

Basically i'm trying to upload a file with a simple paragraph of text for processing. The curious part is that when I run this exact curl in a bash script, everything works smoothly, but when I try to run it through mashape, it says either 400 Bad Request or 500 Internal Server Error

In my particular case, these errors are generated when I don't pass correct form or headers. So my question is: Is there an error in the curl syntax or should I keep looking for the error on server side?

EDIT: I figured out what the problem was. -F 'file=@sample.docx' was passed before -F 'meta....' and that was causing the 500 Internal Server Error So now the question is: Is there any way to specifically arrange the order of the form fields (because mashape rearranges them aplhabetically)?

  • I am willing to provide additional screenshots, should that be necessary –  Sep 28 '15 at 16:21
  • can you link to API page on Mashape? – API_sheriff_orlie Sep 28 '15 at 17:33
  • I can't, I haven't published it yet. I can't publish it when something is not working properly which is why I want to know whether to look for the error on my side or to contact mashape support –  Sep 29 '15 at 06:40

0 Answers0