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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Thingworx update infotable property values with API put method

NiKlaus
12-Amethyst

Thingworx update infotable property values with API put method

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:

JSON Content for HealthAndSafetyReport Was Not ValidProperties. 

When I use the Get method, I get the following response: 

 

{
    "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. 

ACCEPTED SOLUTION

Accepted Solutions
NiKlaus
12-Amethyst
(To:NiKlaus)

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. 

View solution in original post

1 REPLY 1
NiKlaus
12-Amethyst
(To:NiKlaus)

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. 

Announcements


Top Tags