02-07-2017 04:09 AM - edited 03-12-2019 06:16 AM
Dear Support,
am trying to use API to push a bulk of configuration to Firepower 6.1 or 6.2 but without success, i tried to POST multi Network Object as shown below :
under network i POST the below configuration:
https://xxx.xxx.xxx.xxx/api/fmc_config/v1/domain/e233abec-e0f2-11e3-2321-6d9ed49b625f/object/networks
Body:
-----------------------
{
"name":"testing",
"type":"Network",
"description": "testing",
"value": "2.2.90.0/24"
},
{
"name":"testing2",
"type":"Network",
"description": "testing2",
"value": "2.2.91.0/24"
}
----------------
it return with Syntax errors.
can you please provide me with right way to POST multi network Object or any kind of configuration through REST API.
BR,
Hamoud Hamdan
Solved! Go to Solution.
12-26-2017 08:06 AM
Hello.
I have the next issue, when I run the next commands:
python prueba.py Prueba.csv
File "prueba.py", line 59
reader = csv.DictReader(open(variables_file, 'rb'))
^
IndentationError: expected an indented block
***************************************************************
This is the code of python in the file, the file "prueba.csv" contains the next:
prueba.CSV
name | type | value | description |
test | Network | 6.6.6.0/24 | test |
12-28-2017 10:08 AM
08-09-2017 10:28 AM
08-09-2017 11:36 AM
Nope, originally I thought it was the 1.1.1.1/24 so I fixed it to be 1.1.1.0/24 but still will not use it.
08-09-2017 11:49 AM
Is not your request data should look like this?
{ "name": "Test6", "type": "Network", "value": "1.1.1.0/24", "description": "Test Description" }
instead of
{ "name": "test6", "value": "1.1.1.1/24", "type": "Network" }
08-09-2017 12:04 PM
/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
{ "name": "Test6", "type": "Network", "value": "1.1.1.0/24", "description": "Test Description" }
Status code is: 422
Nope still doesn't like it. I get this every time.
04-26-2018 01:04 PM - edited 04-26-2018 01:16 PM
[moved]
11-30-2017 03:09 AM
Dear Neipatel,
I would like to reopen this case 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.
01-23-2018 01:28 AM
03-09-2018 01:00 AM
04-26-2018 01:17 PM
Hey Guys -- to piggy back on this, I got bulk imports working with Postman.
Create your basic POST with proper header (X-auth-access-token) and authorization.
Set path to: https://<firesight manager ip>/api/fmc_config/v1/domain/<domain UUID>/object/networks (can change this to hosts if you're importing hosts)
Next modify your body -- set to raw -- type JSON (on the end) -- and use the following:
{"type": "{{type}}","value": "{{value}}","description": "{{description}}","name": "{{name}}"}
Save it.
Next Go to Runner (top)
Select your POST in your collection (left side)
Next select your data file (left bottom, browse).
Format should be like so:
[
{
"type": "Network",
"value": "5.5.5.5/21",
"description": "My Route",
"name": "RT-5.5.5.5-21"
},
{
"type": "Network",
"value": "6.6.6.6/24",
"description": "My Route",
"name": "RT-6.6.6.6-24"
}]
Change type to JSON, click preview, should see data as you would expect.
Click Run <collection name> at bottom (blue button)
You should receive results back that state "201 Created ....."
04-26-2018 01:52 PM
04-26-2018 07:28 PM
You are correct, they are multiple calls. I was trying to offer an additional way to overcome the lack of the bulk import feature. Sorry for any misleading!
09-01-2018 11:20 PM
Thanks so much for this info! Though only the first entry in the JSON file containing the hosts is being created?
Below is the contents of test_host.json which I'm selecting in the Collection Runner in Postman. The preview shows both lines of data. And the Run Results show 201 Created. But only the first object is created.
Any advice or thoughts?
[
{
"type": "Host",
"value": "7.7.7.7",
"description": "TEST-HOST-7-Desc",
"name": "TEST-HOST-7"
},
{
"type": "Host",
"value": "8.8.8.8",
"description": "TEST-HOST-8-Desc",
"name": "TEST-HOST-8"
}]
12-28-2018 08:48 AM
Tryed your method with Postmon but I keep receiving 401 error Unauthorized, even though I've generated the toke correctly. Any tips?
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