Skip to main content
1-Visitor
July 28, 2015
Question

Automating Thingworx Server Setup

  • July 28, 2015
  • 2 replies
  • 6466 views

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

2 replies

1-Visitor
July 29, 2015

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)

5-Regular Member
August 2, 2015

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

1-Visitor
August 12, 2015

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?

1-Visitor
September 25, 2015

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