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

Automated Entity Import

Amethyst

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.

3 REPLIES 3

Re: Automated Entity Import

clipboard_image_0.png

I have tried do import as your step but got this error.

Re: Automated Entity Import

I think the problem is that the curl command is not installed on your version of Linux. So you need to search online for the install steps for your version of Linux, for example "linux ubuntu install curl".

Re: Automated Entity Import

Thanks, It's truly my mistake, and I have reinstalled my CURL tool.

For now, I have also successfully imported this TestThing.Xml under your useful guidance, but how should I do to import Multiple files (e.g. DataShape, ThingShape and ThingWorx Extension etc) at once, Expect for your replies ! !

clipboard_image_0.jpeg

clipboard_image_1.jpeg

Announcements