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

Automated Entity Import

Highlighted
Level 8

Automated Entity Import

In case it's useful for anyone, I successfully used the Thingworx Importer to import an Entity using version 8.4.1. The import command was in a CURL script (can also be run using e.g. Cygwin on Windows) and the entity data was contained in an XML file. The XML file is attached to this post, and the CURL script is copied into the bottom of the post body.

 

Notes on using the script:

  • Copy CURL code into import.sh
  • You might need to change the line endings to UNIX, e.g. in Notepad++ menu option Edit > EOL Conversion > Unix
  • Give permissions to run import.sh (chmod +x import.sh)
  • ./import.sh

>>>>>>>>>>>>

#!/bin/bash

APPKEY="2e6704c0-XXXX-XXXX-XXXX-a1589e387d1a"
TWX_HTTP_PORT="8018"
FILE_PATH_TWX="Things_testImport.xml"
PROTOCOL="http://"
IP="localhost"

URL="$PROTOCOL""$IP"":""$TWX_HTTP_PORT""/Thingworx/Importer?purpose=import"

curl -X POST -H 'appKey: '$APPKEY \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-H 'x-thingworx-session: true' \
-H 'X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE' \
-F 'upload=@'$FILE_PATH_TWX \
$URL

<<<<<<<<<<<<

 

Also TWX Importer is explained in this support article.