05-08-2018 01:04 AM - edited 02-21-2020 07:44 AM
Hey everyone,
I'm creating a script that adds hosts and groups to FMC, however it seems that when you want to add hosts to a group you need the unique id for that host and not only the name for the host. Which is a bit of a nightmare as you need to collect the id for this first.
Can someone confirm this?
Thanks
Stijn
05-08-2018 05:53 AM
05-08-2018 06:53 AM
Ok thanks for the reply, the only problem with a GET for all hosts is that the reply is paged.
So the script needs to send GETs for every page. Need to figure out how to do that.
But thank you for confirming.
05-08-2018 08:14 AM
05-08-2018 01:09 PM
That would indeed be a possibility, but it's not very durable. Our environment will easily surpass 1000 hosts. To be honest, collecting 1000 hosts to update 1 is not a great use of resources.
However I have noticed something, apparently when you try to push an already existing object it will obviously throw an error but it will also return the object id in the return message.
If that is correct then you could first try to push an object and just collect the objectid like that.
Maybe neipatel could confirm that this is a possibility?
Thanks
Stijn
10-25-2018 09:34 AM
I don't know if you've found a good solution for this, but I'm currently making some headway here. In the initial GET of a collection, one of the collections returned is "paging", which contains the URL for the next page. I have found that it is trivial to capture that URL and then iterate over the collection in that manner. I can provide a code example, if it's helpful!
HTH,
Colin
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide