autodesk-tandem

Not getting any elements when running modeldata/{modelID}/scan when filtering by known key


I have been trying to read a single element using the api as described here:

https://aps.autodesk.com/en/docs/tandem/v1/reference/quick_reference/tandem-data-scan-POST/

I have the key for the element which I retrieved using the code here: https://github.com/autodesk-tandem/tutorial-rest/blob/main/assets/read-asset-properties.js, which essentially loops through all assets and links them to their schema, outputting the keys.

However, my call is not returning anything (I just get the single "v1" object)

POST
{
    "families": [
        "n",
        "l",
        "x",
        "r",
        "z"
    ],
    "includeHistory":true,
    "skipArrays":false,
    "keys":[ "AdWEC4j1SUizSMxCxb93HwXXXX" ]
}

Am I missing something or is there an issue with the API? I notice that running the same command with a GET method returns a seemingly random selection of items, and not the one specified by the key.


Solution

  • When key is specified then the endpoint should return selected properties for given element from provided model. Note that model URN isn't same as facility URN - one facility can have multiple models. To get list of models for given facility use GET twins/:twinID endpoint.

    In your case it should also return history of changes for that element - this is because includeHistory is set to true.

    You also mentioned GET method - the method is less flexible compared to POST where you can specify additional options. It's recommended using POST instead of GET. Also note that GET method isn't documented as part of public API.