01-11-2023 02:12 PM
Hi experts, I am wondering if I can GET multiple network objects in one API call to the FMC. I found the following URL for querying one network object (from the postman collection)
{{protocol}}://{{hostname}}/api/fmc_config/v1/domain/{{domain_id}}/object/networks/{{network_id}}
I also have the same need for host objects and object groups and I hope the solution is the same for them.
Thanks!
Difan
01-12-2023 01:43 AM
Check if these procedures could work for you (not tested myself) , or else you may 'take hints' from these info's
- To get multiple objects with the REST API on Cisco FMC, you can use the GET
method and specify the objects you want to retrieve in the URL. For example, to get all of the objects in the "object_group" resource, you can use the following URL:
https://<FMC IP>/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/object/objectgroups
You can also filter the objects you retrieve by specifying query parameters in the URL. For example, to get all objects in the "object_group" resource that have the name "TestGroup", you can use the following URL:
https://<FMC IP>/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/object/objectgroups?name=TestGroup
Make sure to replace the <FMC IP>
placeholder with the actual IP address or hostname of your Cisco FMC device, and e276abec-e0f2-11e3-8169-6d9ed49b625f
with your domain UUID. You should also include a valid Authorization
header in your GET
request, with a value of "Bearer <access_token>", where <access_token>
is a valid token obtained by authenticating to the Cisco FMC.
M.
01-12-2023 09:53 AM
Thanks, Marce for your response. I apologize that I might not make my question clear... I know how to query for a specific object or all objects. However, is it possible to query for several objects with their object IDs?
01-12-2023 11:07 PM
- Try to use the bulk export feature to export multiple objects of the same type (e.g. networks, host objects, object groups) in one API call. The URL for bulk export is as follows:
{{protocol}}://{{hostname}}/api/fmc_config/v1/domain/{{domain_id}}/object/{{object_type}}?expanded=true&limit={{limit}}&offset={{offset}}
where:
You can also filter the export by adding additional query parameters to the url.
For example, you could use the following URL to export all network objects in the domain with ID "12345678-1234-1234-1234-123456789abc":
{{protocol}}://{{hostname}}/api/fmc_config/v1/domain/12345678-1234-1234-1234-123456789abc/object/networks?expanded=true
It's also possible to export multiple object types in one call. To do this, you would need to use the export endpoint with the object types separated by commas.
For example:
{{protocol}}://{{hostname}}/api/fmc_config/v1/domain/{{domain_id}}/object/networks,hostobjects,objectgroups
M.
01-13-2023 06:36 AM
I do not believe it is possible to GET multiple network objects based on their ID in one GET call, I don't think the API in FMC supports this...yet.
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