I am trying to upload a picture through the REST API, following the documentation but I keep having error. This is what my problems are. Note: I performed this through Swift.
- I followed the documentation and set Content-Type: application/json. However, I am getting error 400 and after reading the error message I noticed that I need to use Content-Type: multipart/form-data.
- I changed to multipart/form-data and try to upload my image, but I am having a problem where the result returned is not a JSON file and the upload didn’t work at all.
- So I tried to upload a simple .txt file as shown in the example, and it returned me the result JSON file with the result url. However, the problem is that when I look into the Console, the file is not inside the folder at all. I tried to open the result url but it gave me Error 6007, Resource not found.
- So I tried to use the curl as shown in the example, and it works. But then, writing it through the code in Swift doesn’t work. I believe the Swift code is correct.
Is it a problem with Swift itself, Backendless REST API, or is there something I did wrong or missed? I checked the permission everything is default. Thank you.