Forum Discussion
AFM - How to add an element to an addresslist with iControlREST
As David confirmed above in the comments, this isn't possible without a full replace. There is an enhancement request (ID587457) with product development to make firewall address lists to be subcollections like firewall policies so that full replace is not required. Until then, using a high level language you can accomplish this by:
- GET the object (maybe use $select to fetch only the addresses array).
- Using the JSON representation- it is a simple array- add, subtract, etc. entries as required.
- PATCH the object with the changed payload.
I've ran into a strange issue where if I do a GET request as described above first it fails....if I do the POST first and the exact same get request after it works. Is there something with rest and having to do a post first? When i do the get statement first I just get
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
The GET request works when it comes after the POST in the script but the moment I comment out the post request I start getting this error...Obviously none of this helps me because I need to do the get request first to get the list before I post a new list to it.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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