API Add Media - Error Filetype Not Allowed

Hello,

I am trying to add media to the library via the API. I am using postman, and am able to get a token and retrieve various pieces of data via the API.

I am now trying to upload an image, and am getting this error:

{“files”:[{“name”:“1535143374-0032”,“size”:100279,“type”:“multipart/form-data; boundary=--------------------------005954883975465110847801”,“error”:“Filetype not allowed”}]}

The actual image file types I’ve tried are jpg and png.

Here are a couple of screenshots from Postman:

Can anyone give me any tips on what might be causing this?

Thanks!!

I have a feeling you need to use x-www-form-urlencoded not form-data, but I could be wrong. It’s not really my area of expertise.

Alex,

If I select “x-www-form-urlencoded” rather than “form-data”, then the option to “Choose Files” goes away.

Thanks,
Paul

You’d need to specify the key type to file again etc.

However that is not needed, form-data is what you should use.

It’s all explained in our API introduction guide, there is also postman collection link there with several calls, including library upload - API Introduction with Postman