Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
I am looking to use the API's put method to update an infotable property on a specific thing. Using postman I currently get a 406 - Not Accepted with the message being:
{
"dataShape": {
"fieldDefinitions": {
"HealthAndSafetyReport": {
"name": "HealthAndSafetyReport",
"description": "",
"baseType": "INFOTABLE",
"ordinal": 24,
"aspects": {
"isIndexed": false,
"isPersistent": true,
"isLogged": false,
"dataChangeType": "VALUE",
"dataShape": "HealthandSafetyReport_DS",
"cacheTime": 0.0
}
}
}
},
"rows": [
{
"HealthAndSafetyReport": {
"dataShape": {
"fieldDefinitions": {
"Daily": {
"name": "Daily",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Date": {
"name": "Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Month_To_Date": {
"name": "Month_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Project_To_Date": {
"name": "Project_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Statistic": {
"name": "Statistic",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"timestamp": {
"name": "timestamp",
"description": "",
"baseType": "DATETIME",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Week_To_Date": {
"name": "Week_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
}
}
},
"rows": [
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Fatality",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Lost Time Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "6",
"Statistic": "Medical Treatment Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Restricted Work Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "8",
"Statistic": "First Aid Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "12",
"Date": "2023/3/2",
"Month_To_Date": "60",
"Project_To_Date": "25745",
"Statistic": "Stop & Fix",
"timestamp": 1677715200000,
"Week_To_Date": "60"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Occupational Exposure",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "14",
"Statistic": "Property Damages",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "1944",
"Date": "2023/3/2",
"Month_To_Date": "9684",
"Project_To_Date": "1534346",
"Statistic": "Total Man-hours worked",
"timestamp": 1677715200000,
"Week_To_Date": "9684"
},
{
"Daily": "2",
"Date": "2023/3/2",
"Month_To_Date": "8",
"Project_To_Date": "1200",
"Statistic": "Shifts Worked",
"timestamp": 1677715200000,
"Week_To_Date": "8"
},
{
"Daily": "162",
"Date": "2023/3/2",
"Month_To_Date": "172",
"Project_To_Date": "490",
"Statistic": "Manpower onsite for the day",
"timestamp": 1677715200000,
"Week_To_Date": "172"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Environmental Incidents",
"timestamp": 1677715200000,
"Week_To_Date": "0"
}
]
}
}
]
}
So I thought that if I "put" data that is of the exact same format- I should get a 200 ok response.
This is what my API call looks like in the cURL format:
curl --location --request PUT 'https://thingworxURL/Thingworx/Things/HealthAndSafety_Thing1/Properties/HealthAndSafetyReport' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'AppKey: xxx-xxx-xxx-xxx' \
--data '{
"dataShape": {
"fieldDefinitions": {
"HealthAndSafetyReport": {
"name": "HealthAndSafetyReport",
"description": "",
"baseType": "INFOTABLE",
"ordinal": 24,
"aspects": {
"isIndexed": false,
"isPersistent": true,
"isLogged": false,
"dataChangeType": "VALUE",
"dataShape": "HealthandSafetyReport_DS",
"cacheTime": 0.0
}
}
}
},
"rows": [
{
"HealthAndSafetyReport": {
"dataShape": {
"fieldDefinitions": {
"Daily": {
"name": "Daily",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Date": {
"name": "Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Month_To_Date": {
"name": "Month_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Project_To_Date": {
"name": "Project_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Statistic": {
"name": "Statistic",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"timestamp": {
"name": "timestamp",
"description": "",
"baseType": "DATETIME",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Week_To_Date": {
"name": "Week_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
}
}
},
"rows": [
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Fatality",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Lost Time Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "6",
"Statistic": "Medical Treatment Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Restricted Work Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "8",
"Statistic": "First Aid Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "12",
"Date": "2023/3/2",
"Month_To_Date": "60",
"Project_To_Date": "25745",
"Statistic": "Stop & Fix",
"timestamp": 1677715200000,
"Week_To_Date": "60"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Occupational Exposure",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "14",
"Statistic": "Property Damages",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "1944",
"Date": "2023/3/2",
"Month_To_Date": "9684",
"Project_To_Date": "1534346",
"Statistic": "Total Man-hours worked",
"timestamp": 1677715200000,
"Week_To_Date": "9684"
},
{
"Daily": "2",
"Date": "2023/3/2",
"Month_To_Date": "8",
"Project_To_Date": "1200",
"Statistic": "Shifts Worked",
"timestamp": 1677715200000,
"Week_To_Date": "8"
},
{
"Daily": "162",
"Date": "2023/3/2",
"Month_To_Date": "172",
"Project_To_Date": "490",
"Statistic": "Manpower onsite for the day",
"timestamp": 1677715200000,
"Week_To_Date": "172"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Environmental Incidents",
"timestamp": 1677715200000,
"Week_To_Date": "0"
}
]
}
}
]
}'
I don't understand the api documentation and cannot find the specific method of using put with an info table.
Not sure if anyone can suggest something or help me with this.
Thanks in advance.
Solved! Go to Solution.
I got lucky and tried a the format below and it worked:
{
"HealthAndSafetyReport": {
"dataShape": {
"fieldDefinitions": {
"Daily": {
"name": "Daily",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Daily_Num": {
"name": "Daily_Num",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Date": {
"name": "Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Month_To_Date": {
"name": "Month_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Project_To_Date": {
"name": "Project_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Statistic": {
"name": "Statistic",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"timestamp": {
"name": "timestamp",
"description": "",
"baseType": "DATETIME",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Week_To_Date": {
"name": "Week_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
}
}
},
"rows": [
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Fatality",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Lost Time Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "6",
"Statistic": "Medical Treatment Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Restricted Work Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "8",
"Statistic": "First Aid Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "12",
"Date": "2023/3/2",
"Month_To_Date": "60",
"Project_To_Date": "25745",
"Statistic": "Stop & Fix",
"timestamp": 1677715200000,
"Week_To_Date": "60"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Occupational Exposure",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "14",
"Statistic": "Property Damages",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "1944",
"Date": "2023/3/2",
"Month_To_Date": "9684",
"Project_To_Date": "1534346",
"Statistic": "Total Man-hours worked",
"timestamp": 1677715200000,
"Week_To_Date": "9684"
},
{
"Daily": "2",
"Date": "2023/3/2",
"Month_To_Date": "8",
"Project_To_Date": "1200",
"Statistic": "Shifts Worked",
"timestamp": 1677715200000,
"Week_To_Date": "8"
},
{
"Daily": "162",
"Date": "2023/3/2",
"Month_To_Date": "172",
"Project_To_Date": "490",
"Statistic": "Manpower onsite for the day",
"timestamp": 1677715200000,
"Week_To_Date": "172"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Environmental Incidents",
"timestamp": 1677715200000,
"Week_To_Date": "0"
}
]
}
}
The above was my body message / data that was posted.
I got lucky and tried a the format below and it worked:
{
"HealthAndSafetyReport": {
"dataShape": {
"fieldDefinitions": {
"Daily": {
"name": "Daily",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Daily_Num": {
"name": "Daily_Num",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Date": {
"name": "Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Month_To_Date": {
"name": "Month_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Project_To_Date": {
"name": "Project_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Statistic": {
"name": "Statistic",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"timestamp": {
"name": "timestamp",
"description": "",
"baseType": "DATETIME",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
},
"Week_To_Date": {
"name": "Week_To_Date",
"description": "",
"baseType": "STRING",
"ordinal": 0,
"aspects": {
"isPrimaryKey": false
}
}
}
},
"rows": [
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Fatality",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Lost Time Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "6",
"Statistic": "Medical Treatment Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Restricted Work Incident",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "8",
"Statistic": "First Aid Case",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "12",
"Date": "2023/3/2",
"Month_To_Date": "60",
"Project_To_Date": "25745",
"Statistic": "Stop & Fix",
"timestamp": 1677715200000,
"Week_To_Date": "60"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Occupational Exposure",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "14",
"Statistic": "Property Damages",
"timestamp": 1677715200000,
"Week_To_Date": "0"
},
{
"Daily": "1944",
"Date": "2023/3/2",
"Month_To_Date": "9684",
"Project_To_Date": "1534346",
"Statistic": "Total Man-hours worked",
"timestamp": 1677715200000,
"Week_To_Date": "9684"
},
{
"Daily": "2",
"Date": "2023/3/2",
"Month_To_Date": "8",
"Project_To_Date": "1200",
"Statistic": "Shifts Worked",
"timestamp": 1677715200000,
"Week_To_Date": "8"
},
{
"Daily": "162",
"Date": "2023/3/2",
"Month_To_Date": "172",
"Project_To_Date": "490",
"Statistic": "Manpower onsite for the day",
"timestamp": 1677715200000,
"Week_To_Date": "172"
},
{
"Daily": "0",
"Date": "2023/3/2",
"Month_To_Date": "0",
"Project_To_Date": "0",
"Statistic": "Environmental Incidents",
"timestamp": 1677715200000,
"Week_To_Date": "0"
}
]
}
}
The above was my body message / data that was posted.