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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Can't upload CSV to AnalyticsUploadStorage via REST

ashu_shukla
8-Gravel

Can't upload CSV to AnalyticsUploadStorage via REST

Hi everyone,

I'm using Postman to test the REST APIs for TW Analytics and I've made most of them work even though there is a lack of proper list of all APIs pertaining to Analytics.

I'm having problem with uploading the CSV to AnalyticsUploadStorage which will be used to create a dataset.

In the documentation here, they even mention an incorrect service name to do that (CreateFileText instead of CreateTextFile). I got the correct API endpoint by calling /Thingworx/Things/AnalyticsUploadStorage but I get the following error when I try to call it:

Unable to Invoke Service CreateTextFile on AnalyticsUploadStorage : null

Here is the Postman REST call:

POST https://<serverIP>/Thingworx/Things/AnalyticsUploadStorage/Services/CreateTextFile?appKey=<appKey>

form-data:

data: csv_file.csv

path: "/UptimeDowntimeData/csv_file.csv"

overwrite: true

I've also tried passing these values as application/json with data field having content of csv file as a string but to no avail.

 

Upload CSV REST call

 

1 ACCEPTED SOLUTION

Accepted Solutions
cmorfin
19-Tanzanite
(To:ashu_shukla)

Hi

I think this article: https://www.ptc.com/en/support/article?n=CS236873 can be useful.

The CreateTextFile will test text data as input, so you enter the content of your csv file in it.

Also the path and data should be provided in the body.

the below works for me:

api-upload.png

 

Note the \n added to mark the end of line.

 

Hope this helps

Christophe

 

View solution in original post

2 REPLIES 2
cmorfin
19-Tanzanite
(To:ashu_shukla)

Hi

I think this article: https://www.ptc.com/en/support/article?n=CS236873 can be useful.

The CreateTextFile will test text data as input, so you enter the content of your csv file in it.

Also the path and data should be provided in the body.

the below works for me:

api-upload.png

 

Note the \n added to mark the end of line.

 

Hope this helps

Christophe

 

Hi @cmorfin,

As I mentioned in my last line, I did try it that way. But I used actual newline instead of '\n' which I think was the problem.

Thanks.

Top Tags