API request returns text/html and not a json object

You have a duplicate header:

Content-Type is about what you send, and Accept is about what you want in return.
So you’ll need to change this to

headers["Content-Type"] = "multipart/form-data"
headers["Accept"] = "application/json"
5 Likes