Forum Discussion

Lewis_Beard's avatar
3 years ago

Using the API to rename a property (on a group)?

All,

I want to rename a property on a group using the API.

I see the verbs for /device/groups/{gid}/properties/ ..... POST and GET.
I see the following verbs for /device/groups/{gid}/properties/{name} ..... PATCH, DELETE, GET, PUT.

I'm currently using a stored procedure that uses PUT and POST to set or update properties by name, buy building a short json body with the name and the value, and then doing a PUT to create the property, and if an error comes back, depending on the error, doing a POST.

But I'm not actually sure how to RENAME the property itself.

Would i need to do a GET to obtain the value, then do a DELETE on the property, and then do the PUT with the value I retained?

Or is there a one-step rename option somewhere in the API? Basically, I'm hoping there is a way to update in 1 step instead of 3.

Thanks!
 

  • Anonymous's avatar
    Anonymous
    3 years ago
    7 minutes ago, Lewis Beard said:

    Would i need to do a GET to obtain the value, then do a DELETE on the property, and then do the PUT with the value I retained?

    That's how I would do it. No one step that I know of.

  • Thanks. I figured that was the case. I guess really, I should do a GET, then do a PUT/POST on the new one first, to make sure there is no error and that the value isnt lost. And only then do the delete at the end if everything else works.

    Appreciate the response as always!

  • Anonymous's avatar
    Anonymous
    7 minutes ago, Lewis Beard said:

    Would i need to do a GET to obtain the value, then do a DELETE on the property, and then do the PUT with the value I retained?

    That's how I would do it. No one step that I know of.