cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to upload an extension using ExtensionPackageUploader REST Service

bwinslow24
12-Amethyst

How to upload an extension using ExtensionPackageUploader REST Service

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

2 REPLIES 2
supandey
19-Tanzanite
(To:bwinslow24)

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

 

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.  

Announcements


Top Tags