Forum Discussion

JOEL_KING's avatar
JOEL_KING
Icon for Nimbostratus rankNimbostratus
Jan 07, 2016

Modifying objects with PUT or PATCH iControl REST

As a bit of background, in working with the Cisco APIC northbound REST API, if you issue a POST command to create an object, it will create it the first time, but subsequent API calls will not make changes to the configuration if the object exists and all the values of specified are the same. In both instances you get a return code of 200 and you can specify on the URL "?rsp-subtree=modified" which provides a status back of either 'created' or 'modified'.

 

In working with the iControl REST interface, I understand that to create an object you issue a POST to create an object and a PUT / PATCH to edit. Programmatically, I am issuing a POST, if a 409 is returned indicating the object exists, I was modifying the URL to remote the 'name' from the body, and appending that to the URL, then issue the PATCH.

 

However, I'm finding that there are other fields in the body that can't be specified in the context of the "modify" command. For example updating an LTM node, I can't include an 'address' in the body, the PATCH will fail with a 400.

 

I'd like to get to the point where my users can specify the same values regardless if they are creating a new object or modifying an existing object. Any advice would be appreciated.