Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi everyone,
I'm using REST API to automate my application with TW Analytics. I've succesfully uploaded CSV and JSON files to AnalyticsUploadStorage using CreateTextFile service. However when creating a dataset with the uploaded files using /Thingworx/Things/AnalyticsServer_Thing_DataThing/Services/CreateDataset which gives 200 OK, but the job fails with following error in the GetJobInfo api response: ProtocolException: The server failed to respond with a valid HTTP response
Creating dataset through Analytics Builder works fine but I require REST API for automating. When I look at the call that the AnalyticsBuilder is using, its the CreateDatasetAMS service of the TW_ML_Helper Thing. Using that in postman also gives 200 OK but the subsequent GetJobInfo returns with the same error.
Can anyone tell me what's wrong here...
Solved! Go to Solution.
Hi
I was talking to the DevZone team but it appears that the hosted instances are not meant to be used with Analytics as there are some known issues.
Instead all the Analytics Quickstart Guides point to use the Analytics Trial Edition (ATE) that is downloadable from https://developer.thingworx.com/resources/downloads .
I understand that it used to work but unfortunately there is no support from the DevZone team for the analytics component on the hosted instances.
So the best way forward for you is to download and install the ATE.
Hope this helps
Kind rgeards
Christophe
Hi
Could you show your CreateDataset post request body ?
Also the ThingWorx Analytics log files https://www.ptc.com/en/support/article?n=CS268761
If possible post also the csv and json file you are uploading.
Thanks
Christophe
Hi @cmorfin,
Here are the two POST request:
https://<serverIp>/Thingworx/Things/AnalyticsServer_Thing_DataThing/Services/CreateDataset?appKey=<appKey>
Request Body:
{
"csvURI": "thingworx://AnalyticsUploadStorage/UptimeDowntimeData/sample_csv1.csv",
"csvHasHeaders": true,
"metadataFileURI": "thingworx://AnalyticsUploadStorage/UptimeDowntimeData/sample_csv1_metadata.json"
}
AND
https://<serverIP>/Thingworx/Things/TW_ML_Helper/Services/CreateDatasetAMS?appKey=<appKey>
(got this API from browser console)
Request Body:
{
"AnalyticsServerRuntimeInstance": "AnalyticsServerRuntimeInstance",
"dataFilePath": "Administrator/UptimeDowntimeData/sample_csv1.csv",
"datasetName": "ud_dataset_api1",
"datasetRepo": "AnalyticsUploadStorage",
"hasHeader": true,
"metaFilePath": "Administrator/UptimeDowntimeData/sample_csv1_metadata.json",
"metaRepo": "AnalyticsUploadStorage"
}
THEN
https://<serverIp>/Thingworx/Things/AnalyticsServer_Thing_DataThing/Services/GetJobInfo?appKey=<appKey>
Request Body:
{"jobId": "<jobId>"} return above error.
I've also attached the sample csv file.
Here is metadata JSON:
[
{
"fieldName": "no_of_short_stops",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "no_of_long_stops",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "no_of_uptime",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "total_uptime",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "total_downtime",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "no_of_cycles",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "no_of_end_cycles",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "no_of_parts_changed",
"dataType": "INTEGER",
"opType": "CONTINUOUS"
},
{
"fieldName": "current_part",
"dataType": "STRING",
"opType": "INFORMATIONAL"
},
{
"fieldName": "current_state",
"dataType": "STRING",
"opType": "INFORMATIONAL"
},
{
"fieldName": "pre_failure",
"dataType": "BOOLEAN",
"opType": "BOOLEAN"
}
]
Since it's a hosted server, I'm still looking for the logs
Hi @cmorfin,
Now I'm getting this error in Analytics Builder also.
Plz help...My application has stopped working now...
Hi
I have contacted the devzone team as I think something got weary on your instance.
As a side note, I was able to upload the data successfully using
https://<serverIp>/Thingworx/Things/AnalyticsServer_Thing_DataThing/Services/CreateDataset?appKey=<appKey>
Request Body:
{
"csvURI": "thingworx://AnalyticsUploadStorage/UptimeDowntimeData/sample_csv1.csv",
"csvHasHeaders": true,
"metadataFileURI": "thingworx://AnalyticsUploadStorage/UptimeDowntimeData/sample_csv1_metadata.json"
}
by the way you should not use https://<serverIP>/Thingworx/Things/TW_ML_Helper/Services/CreateDatasetAMS , this is intended to be used by ThingWorx Analytics Builder.
Kind regards
Christophe
Hi @cmorfin,
Can they tell me what's wrong with this instance then cuz my application has stopped working ryt now...
Hi
I was talking to the DevZone team but it appears that the hosted instances are not meant to be used with Analytics as there are some known issues.
Instead all the Analytics Quickstart Guides point to use the Analytics Trial Edition (ATE) that is downloadable from https://developer.thingworx.com/resources/downloads .
I understand that it used to work but unfortunately there is no support from the DevZone team for the analytics component on the hosted instances.
So the best way forward for you is to download and install the ATE.
Hope this helps
Kind rgeards
Christophe
Hi @cmorfin,
I wasn't using the ATE bcuz of the ThingPredictor issue.
Now that it's resolved, I'm trying again. Will update my posts accordingly.
Hi
The ATE version has been updated, so if you download it again today the version will include the configuration for ThingPredictor.
Regards
Christophe