Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

API - Add IP object to existing IP host group

Is it possible via the API to add a new IPHost object to the HostList of an existing IPHostGroup without overwriting the existing contents of the group?

I am creating an IPHost object via API but also want to then place it in into an existing IPHostGroup with a number of existing items. I haven't been able to figure out the syntax (keep getting status code 529). Once I have the syntax sorted I need to confirm the action, as I assume "add" will fail as the IPHostGroup already exists, and I suspect the "update" action will replace the contents as it does for other objects.

Not sure if it helps, this is the request I came up with for adding the IPHost, just need to then get it into an existing group:

<Request><Login><Username>xxxxxxxx</Username><Password passwordform="encrypt">yyyyyyyyyyyyyyyyyyyy</Password></Login><Set operation="add"><IPHost><Name>ip_zzzz</Name><IPFamily>IPv4</IPFamily><HostType>IP</HostType><IPAddress>1.2.3.4</IPAddress></IPHost></Set></Request>

Thanks.



This thread was automatically locked due to age.
  • Name is always the unique identifier. If the API gets the request to add a object, it will check for the name. If the name already exists, it will update the object. 

    If you want to add existing objects to an existing Host group, you should first "GET" all objects and in a array replace them and "add" the Hostgroup. 

  • Operation "add" actually fails if an object exists, you need to use "update" - at least with IP Hosts. Just not sure on the syntax for updating an existing IP Host Group.

    Any example XML request would be helpful.

    Thanks.