I don’t believe there is a way to add an element, you have to reload the whole thing. I am digging into this though and will let you know for sure very soon.
I have confirmed that you can’t add something to the list, you have to do a full replace, much like a datagroup. So, you would have to read the address list elements in and append what you want and do a HTTP PATCH to the address list using iControlREST and that should do what you want.
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.
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.