Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
I am looking to update multiple properties by making use of the service UpdatePropertyValues but I don't seem to be getting it right.
I am using python to post my data and I get a 200 response back but the values are not actually updating when I use the service QueryNumberPropertyHistory.
This is the URL that I am trying to access:
url = "http://localhost/Thingworx/Things/Area_Thing5/Services/UpdatePropertyValues"
I have also tried:
url = "http://localhost/Thingworx/Things/Area_Thing5/services/UpdatePropertyValues"
and i still get a 200 ok response, which makes it unclear which url is actually correct.
my Payload looks something like this:
{"name":"Item_Count", "value":1112, "timestamp":1702976380000, "quality":"GOOD"}
And then I post it with a content type application/json
I have also tried with a payload: {"name":"Item_Count", "value":1112, "time":1702976380000, "quality":"GOOD"}
Solved! Go to Solution.
Created thing "Demo" and property "speed" (INTEGER)
http://localhost:8080/Thingworx/Things/Demo/Services/UpdatePropertyValues?ts=1702991337784
1702991337784 - Refers UNIX Timestamp
Following payload data will be used to update speed proprty to 10.
{
"values": {
"dataShape": {
"fieldDefinitions": {
"name": {
"name": "name",
"aspects": {
"isPrimaryKey": true
},
"description": "Property name",
"baseType": "STRING",
"ordinal": 0
},
"time": {
"name": "time",
"aspects": {},
"description": "time",
"baseType": "DATETIME",
"ordinal": 0
},
"value": {
"name": "value",
"aspects": {},
"description": "value",
"baseType": "VARIANT",
"ordinal": 0
},
"quality": {
"name": "quality",
"aspects": {},
"description": "quality",
"baseType": "STRING",
"ordinal": 0
}
}
},
"rows": [
{
"name": "speed",
"time": "2023-12-18T18:30:00.000Z",
"value": "10",
"quality": "GOOD"
}
]
}
}
Hi @NiKlaus ,
Please check if the property is getting updated.
To log the incoming data, you have to assign valuestream to the thing. The service "QueryNumberPropertyHistory" will only fetch data if value stream is assigned to the thing and log is enabled for the property "Item_Count".
Please give more details, if not solved.
With regards
Yedukrishnan
Hi @Yedukrishnan Yes the property is set to persist and logged.
I am able to see the property history after using the following API:
Created thing "Demo" and property "speed" (INTEGER)
http://localhost:8080/Thingworx/Things/Demo/Services/UpdatePropertyValues?ts=1702991337784
1702991337784 - Refers UNIX Timestamp
Following payload data will be used to update speed proprty to 10.
{
"values": {
"dataShape": {
"fieldDefinitions": {
"name": {
"name": "name",
"aspects": {
"isPrimaryKey": true
},
"description": "Property name",
"baseType": "STRING",
"ordinal": 0
},
"time": {
"name": "time",
"aspects": {},
"description": "time",
"baseType": "DATETIME",
"ordinal": 0
},
"value": {
"name": "value",
"aspects": {},
"description": "value",
"baseType": "VARIANT",
"ordinal": 0
},
"quality": {
"name": "quality",
"aspects": {},
"description": "quality",
"baseType": "STRING",
"ordinal": 0
}
}
},
"rows": [
{
"name": "speed",
"time": "2023-12-18T18:30:00.000Z",
"value": "10",
"quality": "GOOD"
}
]
}
}
Hi @Sathishkumar_C thank you for your response.
I have done the following:
curl --location 'http://localhost/Thingworx/Things/Area_Thing5/Services/UpdatePropertyValues?ts=1702937532012' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'AppKey: ####' \
--data '{
"values": {
"dataShape": {
"fieldDefinitions": {
"name": {
"name": "name",
"aspects": {
"isPrimaryKey": true
},
"description": "Property name",
"baseType": "STRING",
"ordinal": 0
},
"time": {
"name": "time",
"aspects": {},
"description": "time",
"baseType": "DATETIME",
"ordinal": 0
},
"value": {
"name": "value",
"aspects": {},
"description": "value",
"baseType": "VARIANT",
"ordinal": 0
},
"quality": {
"name": "quality",
"aspects": {},
"description": "quality",
"baseType": "STRING",
"ordinal": 0
}
}
},
"rows": [
{
"name": "VSM_Count",
"time": "2023-12-19T12:12:12.012Z",
"value": "9999",
"quality": "GOOD"
}
]
}
}'
My response is blank:
And still nothing in the value stream.
Hoping you can help further
Response should be 1.
It works fine, however the response is still nothing.
Not sure if it is the thingworx version that I am using.
Hi @Sathishkumar_C it seems to be working on all of my other properties except for one. I am not sure why the one propery is not updateding. I duplicated and deleted the old one and it is working fine.
Thank you for the help.