Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
howardchan
Engaged Sweeper II

I wanted to use API to edit the custom field value. Here is my code.

mutation Site {
    site(id: <site id>) {
        editAsset(
            key: <asset key>,
            fields: { assetCustom: { fields: {
                                        fieldKey: <custom field key>,
                                        value: "API edit testing"
            } } }
        )
    }
}
 
But I got the below error. Anyone could help? thanks.

"message": "Field 'editAsset' of type 'EditAssetResponse' must have a selection of subfields. Did you mean 'editAsset { ... }'?"
1 ACCEPTED SOLUTION
Obi_1_Cinobi
Lansweeper Tech Support
Lansweeper Tech Support

Hello there!

Have you tried debugging your code with an AI assistant like ChatGPT? They are usually very good at helping with these types of queries.

View solution in original post

6 REPLIES 6
Obi_1_Cinobi
Lansweeper Tech Support
Lansweeper Tech Support

Hello there!

We would recommend reaching out to our technical support team if you need further technical assistance, please raise a support case here: https://www.lansweeper.com/contact/contact-support/

If you need technical support and have issues with accessing the Support Portal, please use this URL instead: https://www.lansweeper.com/contact/contact-support-case/

Thanks for the reply. I have created a support case, unfortunately I am told that troubleshooting API is not in the scope of application support. I am still stuck in the problem and have no clue to resolve it.

I found that it didn't work even a simple command to change a preset field. Anyone could help? thanks.
 
mutation Site {
    site(id: <site id>) {
        editAsset(
            key: <key>
            fields: { assetCustom: { comment: "API edit testing" } }
        )
    }
}
Obi_1_Cinobi
Lansweeper Tech Support
Lansweeper Tech Support

Hello there!

Have you tried debugging your code with an AI assistant like ChatGPT? They are usually very good at helping with these types of queries.

Thanks. I did and it worked. At the same time, the technical support also relied me with the same solution.

Obi_1_Cinobi
Lansweeper Tech Support
Lansweeper Tech Support

Thanks for the update! Great to hear that you got this working.