Skip to main content
19-Tanzanite
June 10, 2020
Solved

Best way to upload Video file to Thingworx Repository via REST API

  • June 10, 2020
  • 3 replies
  • 2370 views

Hi all,

 

Could any one suggest best way to upload Video file to Thingworx Repository using REST API. (File size varies from MB to GB )

 

Thanks in Advance.

 

/VR

Best answer by Constantine

Hello @Velkumar,

 

Here's a basic example using cURL:

curl -v -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -H "AppKey: $APPKEY" \
 -F "upload-repository=SystemRepository" \
 -F "upload-submit=Upload" \
 -F "file=@myvideo.mp4;type=video/mp4" "$TWXURL/FileRepositoryUploader"

 

Obviously you would need to adjust the filename and MIME type.

 

Regards,
Constantine

3 replies

16-Pearl
June 10, 2020

Hello VR,

 

After doing some digging on this it looks like the video file will need to be converted to a Base 64 format before you can use one of the Save Services available on the File Repository Thing. These Save Services allow you to upload files directly to the repository. See CS236873 for more information on uploading to a File Repository.

 

Your other options to upload the file directly are the File Upload Widget or the File Transfer Subsystem.

18-Opal
June 11, 2020

Hello @Velkumar,

 

Here's a basic example using cURL:

curl -v -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -H "AppKey: $APPKEY" \
 -F "upload-repository=SystemRepository" \
 -F "upload-submit=Upload" \
 -F "file=@myvideo.mp4;type=video/mp4" "$TWXURL/FileRepositoryUploader"

 

Obviously you would need to adjust the filename and MIME type.

 

Regards,
Constantine

Support
June 24, 2020

Hi @Velkumar.

 

If one of the previous responses allowed you to find a solution, please mark the appropriate one as the Accepted Solution for the benefit of others with the same issue.

 

Thank you for participating in our community!

 

Regards.

 

--Sharon