cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2384
Views
5
Helpful
5
Replies

FMC Network/Host Object using Rest API - error: SubType ???

Beacon Bits
Level 1
Level 1

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;

https://www.cisco.com/c/en/us/td/docs/security/firepower/ftd-api/guide/ftd-rest-api/ftd-api-methods.html#task_14BAEBFFEB594B62968A3DF2B86F6FF5

{
"name": ""test-host,
"description": "Test host object",
"subType": "HOST",
"value": "1.2.3.4",
"type": "networkobject"
}

 

Error in Postman

messages": [
            {
                "description": "Unprocessable Entity - Unrecognized Field 'subType' in request payload"
            }

 

Could anyone please help in how to create host object in FMC through the Rest API?

 

Regards,

B

1 Accepted Solution

Accepted Solutions

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.

View solution in original post

5 Replies 5

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"
}

fmc host object.PNG

I think the documentation on Devnet is for FDM API, which evidently is different.

 

HTH

@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

 "messages": [
            {
                "description": "Input type mismatch. You have entered an invalid value 1.2.3.4 for selected type Network."
            }
 
Thanks! - B

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.

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

Glad I could help

 

POST using /api/fmc_config/v1/domain/DomainUUID/object/networkgroups

Review Cisco Networking products for a $25 gift card