Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi community,
I've been trying to use the service; QueryNamedPropertyHistory() through an API call but not having any success. These are the details of my call:
Method: POST
Body:
params = {
"oldestFirst": false,
"maxItems": 50,
"endDate": null,
"startDate": null,
"query": null,
"propertyNames" : {
"rows": [{
"name": "propertyName",
"description": "propertyDescription"
}],
"dataShape": {
"fieldDefinitions": {
"name": {
"name": "name",
"aspects": {},
"description": "",
"baseType": "STRING",
"ordinal": 1
},
"description": {
"name": "description",
"aspects": {},
"description": "",
"baseType": "STRING",
"ordinal": 2
}
}
}
}
}
Below is my response: I would expect to see the propertyName in the response data alongside the 'timestamp' field. Does anyone have any advice?
Thanks
Andy
I see that the query parameter works when it is written out, for example:
...but i havent had success with a null query...any help appreciated.
Andy
You do not need to define params in the JSON body; this is working for me:
curl -X POST \
http://localhost/Thingworx/Things/TestQueryThing/Services/QueryNamedPropertyHistory \
-H 'accept: application/json' \
-H 'appkey: ' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: 607288b1-b9c4-f9c4-bc3b-1bbe2f49cda6' \
-d '{
"maxItems":2,
"propertyNames":{
"dataShape":{
"fieldDefinitions":{
"name":{
"name":"name",
"baseType":"STRING",
"ordinal":0
}
}
},
"rows":[
{
"name":"test"
}
]
}
}'
Thanks James for your reply. I found success with the following example request body:
Andy