Skip to main content
11-Garnet
November 13, 2025
Solved

Help required to send files from Thingworx to Azure Blob Storage using REST API

  • November 13, 2025
  • 3 replies
  • 482 views

Hello Team,

 

Am trying to upload some pdf files from thingworx repository to azure blob storage using REST API,

 

Could you please share any sample code available for the same?

 

below is what am trying

 

var params = {
url: "https://<AccountName>.blob.core.windows.net/<container>/<folder>?<sasToken>",
headers: {
"x-ms-blob-type": "BlockBlob"
},
content: fileContent, // Ensure this is raw file content
contentType: "application/octet-stream",
timeout: 60000 // 60 seconds
};

// Use ThingWorx HTTP POST/PUT
var result = Resources["ContentLoaderFunctions"].PutText(params);

 

 

 

Not getting any result or error, please help

Best answer by nmutter

why create a new thread? -> https://community.ptc.com/t5/ThingWorx-Developers/File-upload-to-azure-blob-storage/m-p/1036431/highlight/true#M70648 

I would try the request via PostMan tool first, and then try with TWX. Azure also has a sample request where they use AuthorizationHeader (not sure if sasToken works like you have) https://learn.microsoft.com/en-us/rest/api/storageservices/put-blob?tabs=microsoft-entra-id#sample-request 

3 replies

nmutter16-PearlAnswer
16-Pearl
November 14, 2025

why create a new thread? -> https://community.ptc.com/t5/ThingWorx-Developers/File-upload-to-azure-blob-storage/m-p/1036431/highlight/true#M70648 

I would try the request via PostMan tool first, and then try with TWX. Azure also has a sample request where they use AuthorizationHeader (not sure if sasToken works like you have) https://learn.microsoft.com/en-us/rest/api/storageservices/put-blob?tabs=microsoft-entra-id#sample-request 

17-Peridot
November 17, 2025

Hello @Janaki.Raman ,
Not quite sure what your goal is with the transfer.
Have you considered "SaveBinary"  -  CS212085 - How to use blob data to save a physical file as it is to Thingworx server


CS320797 - Connecting Azure Blob Storage to ThingWorx Platform

Regards,

Pehowe

 

11-Garnet
November 18, 2025
params = {
url: "https://<StorageAccount>.blob.core.windows.net/<container>/<filename>?<sasToken>,
headers: {
"x-ms-blob-type": "BlockBlob",
"Content-Type": "text/plain"
},
content: fileContent, // Ensure this is raw file content
timeout: 60000
};
 
result = Resources["ContentLoaderFunctions"].PutBinary(params);
17-Peridot
November 19, 2025

Hello @Janaki.Raman ,

Here is some code. This is a ThingWorx Service which  is sending a file to another ThingWorx environment:
 

Let me know if this is helpful. I will look to see if I have a save Binary or other operations

Regards

Pehowe