Sending a blob file with node


I am trying to upload a pdf file to an orderFile table that is linked to another table.

I was able to add a record with a blank file (by removing the Data field from the body) but when I try to add the pdf file I receive an error of "A stream property was found in a JSON request payload. Stream properties are only supported in responses"


Here is the code: 


const request = require("request");
const fs = require("fs");
async function sendPost() {
  let myPdf = fs.readFileSync("./sales-invoice-template.pdf");
  let myData = myPdf.toString("base64");
  let myBody = {
    Name: "TEST.PDF",
    Data: myData,
    TypeId: myTypeId,
    Version: "1",
    OrderId: myOrderId
  let options = {
    method: "POST",
    url: myURL,
    headers: {
      "cache-control": "no-cache",
      "Accept-Encoding": "gzip, deflate",
      Host: myHost,
      "Cache-Control": "no-cache",
      Accept: "*/*",
      "Content-Type": "application/json;odata=verbose",
      Authorization: "Basic XXXXXXXXXXXXXXXXXXXXX"
    body: myBody,
    json: true
  request(options, function(error, response, body) {
    if (error) throw new Error(error);




Try to debug how the "Files and notes" detail works. It uses the web service with the URL http://MySite/0/rest/FileApiService/Upload

Try to use it for uploading the attachments. 


Eugene Podkovka,

How do we specify the section name? I am trying to use this to upload attachments to a file section? Where do I specify it?

Nikhil Mogare,

It is in the URL of the post request to the FileApiService. The parameter is 


Please investigate how the detail generates the request. There are "upload" methods in the FileDetailV2 and ConfigurationFileApi modules.

Log in or register to comment