cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
215
Views
0
Helpful
2
Replies

FMC - Rest API POST command: networkgroups not working

aherraez
Beginner
Beginner

Hello,

 

I am trying to add a new network group object using some existing objects in the FMC but I am receiving the following message:

description":"The group should have atleast one object reference or a literal as override is not enabled."

 I am trying to add the following networkgroup object:

 

{'name': 'Networkgroup_2', 'objects': [{'type': 'host', 'name': 'Host-2', 'id': '000C29A1-CF6B-0ed3-0000-021474836739'}, {'type': 'range', 'name': 'snmp_servers', 'id': '000C29A1-CF6B-0ed3-0000-021474836781'}], 'type': 'NetworkGroup'} 

 

As I know the names of the objects I have searched for the id of that objects to create the data to use in the POST command.

But I am receiving a 400 error message. 

 

What I am doing wrong? How have to be the payload to create the network group object? In the API documentation seems that I only need these three values for each object that I want to add.

 

Best Regards

 

2 Replies 2

Marius Gunnerud
VIP Advisor VIP Advisor
VIP Advisor

What is the 400 error you are getting? Your data format looks fine.

The following is the format I have used to add a NetworkGroup which works for me.

 

object_data1 = {"type" : "Host",
"id" : "000C29F7-A272-0ed3-0000-034359738409",
"name" : "HOST1"
}

object_data2 = {"type" : "Host",
"id" : "000C29F7-A272-0ed3-0000-034359738427",
"name" : "HOST2"
}

objectGrp = {"type" : "NetworkGroup", "name" : "objectGrp2", "objects" : [object_data1, object_data2]}
--
Please remember to select a correct answer and rate helpful posts

babiojd01
Beginner
Beginner

I can help you out, what are you using? Python? I have an example for both python and powershell if interested? cisco-firepower-api/Firepower-Network-Object-Multipost.py at master · john-babio/cisco-firepower-api (github.com) Take a look at the items.txt file. If you want the powershell version i can give you that as well.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers