Post method for uploading Attachment + JSON data without using FormData() in Airtable Scripting

Topic Labels: API
2159 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Right now I am able to upload attachment (which is there in ‘data’ variable, without using FormData). using this code :

var filename = url.split('/')[url.split('/').length - 1];
        var data = await fetch(url).then(res => res.blob());
        var upload = await fetch("", {
          body : data,   
          headers: {
            Authorization: "token " + key,
            "Content-Disposition": "attachment; filename="+filename,
            "Content-Type": "application/x-www-form-urlencoded"
          method: "POST"

Now I also want to upload JSON data along with the attachment using same Post method . This JSON data will contain cell values of different cloumns in airtable.

For this, the software has curl and JS code for uploading data. It uses form-data option for uploading attachment and other metadata(cell values of the airtable Table). Airtable doesn’t support form-data.

curl code :

curl -H 'Authorization: token db313f24f5738c8e04635e036ec8a45cdd6d6b03' \
  -F content=@document.pdf \
  -F values='{"upload:organization_unit":"Sales"}' \
  -F metadata='{"project":"Market ABC"}' \
0 Replies 0