Help with uplaod a file using API

Mission: FILES MASTER
Task: Upload a file using API

Trying to upload a file using API. I have the superfast.HTML created locally. Have everything ready except not sure how to write the JSON for the body of the request.

Hello @Ron_Mansolo

You can use this doc https://backendless.com/docs/js/files_file_upload.html

Regards, Vlad

Sorry, my fault for not being specific. I’m using the REST API. Here is the instruction I need help with:

Request Body:¶
File contents formatted per the multipart/form-data requirements.

Hi, @Ron_Mansolo

Here is a doc for REST https://backendless.com/docs/rest/files_file_upload.html.
You need to select a request header
Content-Type: multipart/form-data
In Body select form-data and choose the Superfast.html file from your laptop.

Regards,
Marina

Sorry for my continued confusion.

I’ve got header set to Content-Type: multipart/form-data.
The issue is the correct Javascript for the Body. Something like:
{
“form-data”:"@superfast.html"
}

Hello @Ron_Mansolo

You should use “form-data” body. Your cURL should look like this:

curl --location --request POST ‘https://api.backendless.com/APP-ID/API-KEY/files/web/superfast.html
–header ‘Content-Type: multipart/form-data’
–form ‘=@“/home/user/superfast.html”’

Regards,
Inna