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

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Automated Entity Import

No ratings

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.

Comments

image

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

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".

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 ! !

image

image

Version history
Last update:
‎May 15, 2019 09:25 AM
Updated by:
Labels (2)
Attachments