09-10-2020 03:02 AM
Hello everyone,
I need to create over 100 network/host objects in FMC. I'm trying to do through the Rest API.
I have succeeded to create a network object but still not succeeded with host object.
I have used the example from Cisco Devnet Firepower tutorial.
The below example works fine for creating network object.
{
"name": "Test-Network",
"value": "1.0.0.0/24",
"overridable": false,
"description": "Test REST API Object",
"type": "Network"
}
This below example does not work, not sure where the mistake is. I have copied this from;
{
"name": ""test-host,
"description": "Test host object",
"subType": "HOST",
"value": "1.2.3.4",
"type": "networkobject"
}
Error in Postman
Could anyone please help in how to create host object in FMC through the Rest API?
Regards,
B
Solved! Go to Solution.
09-10-2020 08:56 AM
You are trying to create a host object by sending a post to /api/fmc_config/v1/domain/<domain_uuid>/object/networks? it should be /api/fmc_config/v1/domain/<domain_uuid>/object/hosts
If I post my example above to /object/networks I receive the same error you did, but not if I post to object/hosts, then it works correctly.
09-10-2020 07:45 AM - edited 09-10-2020 07:46 AM
Hi @Beacon Bits
The following works on FMC 6.5.0.4, just remove "subType": "HOST",:-
{
"name": "TestHost",
"type": "Host",
"value": "10.5.3.20",
"description": "Test Description"
}
I think the documentation on Devnet is for FDM API, which evidently is different.
HTH
09-10-2020 08:40 AM
@Rob Ingram Thanks for the reply.
I have tried that also (common sense).
{
"name": "TestHost",
"type": "Host",
"value": "10.5.3.20",
"description": "Test Description"
}
But the type here refer to the main Object type that is "Network" and then SubType that could either be Host, Network, FQDN etc.
Please don't get confuse the Type with the SubType.
Unfortunately, it is not working for me.
Error in Postman
09-10-2020 08:56 AM
You are trying to create a host object by sending a post to /api/fmc_config/v1/domain/<domain_uuid>/object/networks? it should be /api/fmc_config/v1/domain/<domain_uuid>/object/hosts
If I post my example above to /object/networks I receive the same error you did, but not if I post to object/hosts, then it works correctly.
09-10-2020 09:11 AM
Thanks @Rob Ingram.
You are correct. I was sending the request to the wrong URL. Cheers!
Could you help me further... ???
I'm adding about 100 hosts and all of these would be in one Network-Group.
How do I link each host to the Network-Group through Rest API call?
Scenario:
network-group: LON-Server-Group
Server1 = 10.5.3.1
Server2 = 10.5.3.1
Server3 = 10.5.3.1
Thanks
B
09-10-2020 11:12 AM
Glad I could help
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