Skip to main content
1-Visitor
September 13, 2018
Question

How to upload an extension using ExtensionPackageUploader REST Service

  • September 13, 2018
  • 2 replies
  • 1930 views

Hi,

 

I am trying to automate my deployment of Thingworx Extensions. I am trying to use the ExtensionPackageUploader to do this. I can't seem to get it working. I get Access to the specified resource has been forbidden when I try to make the call from postman. I get a bad request error when I try to make the call from a curl command. Here is my curl command

 

curl -X POST -H "Accept:application/json" -H "Content-Type:application/json" -H "appKey:secretkey" -H "x-thingworx-session:true" "https://hostname/Thingworx/ExtensionPackageUploader?purpose=import" -F "file=@extension.zip" -k

 

I am on version 8.0

 

Thanks,

Brandon

This topic has been closed for replies.

2 replies

5-Regular Member
September 14, 2018

Hi @bwinslow24 could you try something like this :

 

curl -X POST \
 'http://hostname:port/Thingworx/ExtensionPackageUploader?purpose=import' \
 -H 'Cache-Control: no-cache' \
 -H 'Content-Type: application/json' \
 -H 'X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE' \
 -H 'appKey: <appKey>' \
 -H 'x-thingworx-session: true' \
 -F 'File=@\Downloads\GoogleWidgets_ExtensionPackage.zip'

 

Edit :

Here's how it looked for me in Postman

 

14-09-2018 09-03-40.jpg14-09-2018 09-05-01.jpg

 

1-Visitor
September 26, 2018

Hi @supandey,

 

We were able to get the postman request to work but we are having troubles with the curl command.

 

curl -X POST '<host>/Thingworx/ExtensionPackageUploader?purpose=import' 
-H 'Accept:application/json'
-H 'Cache-Control:no-cache'
-H 'Content-Type:application/json'
-H 'X-XSRF-TOKEN:TWX-XSRF-TOKEN-VALUE'
-H 'appKey:<appKey>'
-H 'x-thingworx-session:true'
-F "File=@\Users\engineeringworkstation5\workspace\TimeSumResource\build\distributions\TimeSumResource.zip" -k

curl: (26) couldn't open file "\Users\engineeringworkstation5\workspace\TimeSumResource\build\distributions\TimeSumResource.zip"

we have tried to switch to single quotes and forward slashes but still doesn't work.

 

Note: We have to put the -k in our command or we get an SSL certificate issue.