Skip to main content
15-Moonstone
March 13, 2019
Solved

How to use Importer to import a XML file

  • March 13, 2019
  • 2 replies
  • 1970 views

Hi,

 

I wonder if it is possible to import a XML file by using REST API

"

POST /Thingworx/Importer?purpose=import& usedefaultdataprovider=false& WithSubsystems=false HTTP/1.1
Host: <<server>>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Accept: */*
Authorization: Basic <<base64>>
cache-control: no-cache

Content-Disposition: form-data; name="file"; filename="R:\TestProject\Things\TestFeature1.xml


------WebKitFormBoundary7MA4YWxkTrZu0gW--

"

 

I tried a HTTP request above, but it did not work 😞

 

My Bests,

Hung Tran

Best answer by PaiChung

The importer service is for importing Thingworx entities, I am assuming that is what you are doing. (to load xml content and parse use the content loader functions)

Did you get your setup from this article?

https://www.ptc.com/en/support/article?n=CS284714&language=en&posno=9&q=importer&ProductFamily=ThingWorx&source=search

If it didn't succeed I would check the Thingworx Application Log

2 replies

PaiChung22-Sapphire IAnswer
22-Sapphire I
March 14, 2019

The importer service is for importing Thingworx entities, I am assuming that is what you are doing. (to load xml content and parse use the content loader functions)

Did you get your setup from this article?

https://www.ptc.com/en/support/article?n=CS284714&language=en&posno=9&q=importer&ProductFamily=ThingWorx&source=search

If it didn't succeed I would check the Thingworx Application Log

htran-2115-MoonstoneAuthor
15-Moonstone
March 14, 2019

Hi PaiChung,

 

Thank you very much, that is exactly what I am looking for. I figured out that Content-Type must be text/xml instead of multipart/form-data.

 

My Bests,

Hung Tran