Forum Discussion
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.
1 Reply
- JOEL_KING
Nimbostratus
It would appear that others have addressed this issue in a similar manner as I described, removing fields from the body which are not permitted in PATCH, as shown in function "_get_safe_patch_payload" in
https://github.com/F5Networks/aws-deployments/blob/master/library/bigip_config.py
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com