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
Solved! Go to Solution.
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
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
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
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
