javascripttandemautodesk-tandem

How to mutate/write the property of an asset using Tandem API?


I am trying change the value of a property of an asset using tabdem api. I am using mutate method provided in the tandem api but I'm unable to find how to change property value. It is asking key and value as argument for query param but I don't what yo give and from to fetch that values.

Please guide me as how to change the properties values using this method.

[enter image description here](https://i.sstatic.net/DYOqw.jpg)

I tried to find the values in the facility but I am not sure from I should get the property value in the facility.


Solution

  • When using mutate endpoint you need to pass three inputs via payload.:

    1. keys if array of element keys to modify
    2. muts is array of array which describe change. Each element of array is array of 4 items:

    The property family and column can be obtained from schema. Use only properties which are part of applied classification.

    1. desc is description of change. It is optional but can help you to find change in the history so it's recommended to put some useful info here.

    Here is sample payload:

    {
        "keys": [
            "IOURj_4LSP2Aon3zJE5quQAgVYM"
        ],
        "muts": [
            [ "i", "z", "1hw", "P010" ]
        ],
        "desc": "Update properties"
    }
    

    Note that size of keys and muts arrays should be same. You can update multiple elements in one call. In case when you want to modify multiple properties of same element then use same key multiple times.

    You may want to check this example.