Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Step-by-Step Configuration and Troubleshooting Best Practices for the NGFW, NGIPS and AMP Technologies A Visual Guide to the Cisco Firepower Threat Defense (FTD)
New Member

POST multiple Objects into one API request

Dear Support,

 

I would like to open a new case about this subject because I have to put over 1500 objects (url, network, host, range) into an FMC (v 6.2.2).

 

The goal is to migrate from an ASA cluster to a Firepower 9300 cluster. And for that, I use the API for extract the data from the ASA, formats it for the Firepower and use the Firepower API for inject the formatted objects

 

My problem is:

- All the examples that I found on the Cisco site show how to post a single object

- The limitation of 120 requests by minutes break my loop

- I'm unable to find a correct and a exact syntax of the JSON body that I need to insert into my API request for post some objects.

 

First of all I would like to know if it's definitely possible to insert some objects in the same API request.

If it's possible, can someone give me the simplest possible example in python language or the syntax in JSON that I have to insert in my python code. 

 

Tanks for all.

6 REPLIES
New Member

Re: POST multiple Objects into one API request

Hello Orhan,

 

I have same problem...

 

I put the JSON format in FMC's API to POST more then one object host and I get an error: JSON parse error 

 


{
"name": "Test108",
"value": "1.1.2.108",
"type": "Host",
"description" : "Teste"
},
{
"name": "Test109",
"value": "1.1.2.109",
"type": "Host",
"description" : "Teste"
}

New Member

Re: POST multiple Objects into one API request

I found a solution that consists of creating a dictionary that contains all the objects in JSON format and create a loop into this dictionary for post each elements

New Member

Re: POST multiple Objects into one API request

Hi Orhan,

Thanks for idea.

 

Well...  Do you create a script and a file using as argument of scritp?

like that?
script.py file.txt

 

 

New Member

Re: POST multiple Objects into one API request

I my case, I created a script that get all the objects and ACL stored in the ASA via the API and convert them into the FMC format and post it with the FMC API.
New Member

Re: POST multiple Objects into one API request

Very nice!!
I'm trying to convert SonicWall objects to Firepower...

But, I need treat this objects in the excel before...

 

I'm migrating one Checkpoint and one SonicWall to Firepower...

For the Checkpoint, I'm using the migration tool of site https://fwmig.cisco.com and after I convert ASA config to Firepower via FMC.

 

 

 

Highlighted
New Member

Re: POST multiple Objects into one API request

Hello Orhan,

 

I tried to do a loop...

 

file.txt

{"name":"Test110","value":"1.1.2.110","type":"Host","description":"Teste"}
{"name":"Test111","value":"1.1.2.111","type":"Host","description":"Teste"}

 

I did:

 

for i in `cat arq.txt`; do perl script.pl admin password $i; done

 

But I get Response code: 401

If I do filling the variable with content it's works fine:
my $data{"name":"Test112","value":"1.1.2.112","type":"Host","description":"Teste"}

 

Let me know if you have some help...

 

Best Regards!!

228
Views
0
Helpful
6
Replies
CreatePlease to create content