Skip to main content
1-Visitor
Jul 28, 2015 3:36 PM UTC
Question

Automating Thingworx Server Setup

Hello,

We are looking at automating the setup of our Thingworx server.  The issue we are running into is in trying to import the extensions, entities, and data programmatically.  I can see that ThingWorx is using /Thingworx/DataImporter, /Thingworx/ExtensionPackageUploader, and /Thingworx/Importer to accomplish these tasks when a user does it via the composer.  Can I make a JSON request to accomplish the same thing, and if so what parameters are required for these three functions?

Thanks,

Tim

10 replies

1-Visitor
Jul 29, 2015 1:48 AM UTC

I believe you have to Post a file, not sure if it will work for the Extension packages, it will work for the Entities and Data.

You could also perhaps do it with the Import From ThingworxStorage

Another shortcut, if you are deploying on the same version of the Thingworx platform, would be to prepare the ThingworxStorage and BackupStorage folders and deploy with those folders populated. (ie on a machine import everything, turn off Tomcat, copy Storage folders to your deployment)

Translate
5-Regular Member
Aug 2, 2015 3:55 PM UTC

Hi,

As Pai said, you can invoke these services programmatically.

Below works for me:

# Import an extension

curl "http://$host/Thingworx/ExtensionPackageUploader?purpose=import&appKey=$APPKEY_ADMIN"  -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -F "file=@Widgets/MyWidget/MyWidget.zip"

# Import Entities (Mashups, Things etc..)

curl "http://$host/Thingworx/Importer?purpose=import&appKey=$APPKEY_ADMIN"   -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -F "file=@Entities_UI.xml"

# Import data

curl "http://$host/Thingworx/DataImporter?purpose=import&appKey=$APPKEY_ADMIN"  -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE"  -F "file=@Sample_Database.json"

Thanks,

Asaf

Translate
1-Visitor
Aug 12, 2015 4:45 AM UTC

Hi,

I am trying to automate the import extension

I am using the following

curl "http://127.0.0.1:8080/Thingworx/ExtensionPackageUploader?purpose=import&appKey=309bdb66-ee46-4e66-821d-e9d118f103da" -F "file=@BMS_Quality_ThingWorx_Extension.zip"

or

curl --user Administrator:Admin http://127.0.0.1:8080/Thingworx/ExtensionPackageUploader?purpose=import" -F "file=@BMS_Quality_ThingWorx_Extension.zip"

I am getting Http Status 500, internal server error

what could be the problem?

Translate
1-Visitor
Sep 25, 2015 7:58 PM UTC

the header should contain X-XSRF-TOKEN:TWX-XSRF-TOKEN-VALUE

Translate