Upload Locally Stored File through HTTP Request API

Hello,

I have been trying to upload files that I’ve kept in Wix site, to upload to an API via HTTP POST, but I have never been able to get the file.

I have tried the following (inside the commented body tag) in the backend code. None of these work.

import { fetch , getJSON } from “wix-fetch” ;

const response = await fetch (“DESTINATION_API_URL”, {
method : ‘post’ ,
headers :
{
“Content-Type” : “multipart/form-data”
},
//body: “file=//3ecc46f5-0587-47b7-84c8-ba92521d8841.usrfiles.com/ugd/3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”
//body: “file=https://3ecc46f5-0587-47b7-84c8-ba92521d8841.usrfiles.com/ugd/3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf
//body: “file=ugd/3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”
//body: “file=3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”

Basically, I just want to pass the local file into the “file” parameter. Can anyone help?

Thank you.

I stored the file inside a collection. If I do a wix-query, I will get the file url = wix : document :// v1 / 3e cc46_fa39c6e46f08410faea96a8cd6758749 . docx / test . docx

I have tried the below combinations to pass the file to the 3rd party API, but none of these work.
//body: “file=document://v1/3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”
//body: “file=wix:document://v1/3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”
//body: “file=//v1/3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”
//body: “file=/v1/3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”
//body: “file=/3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”
//body: “file=3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”
//body: “file=3ecc46_fa39c6e46f08410faea96a8cd6758749.docx/test.docx”