cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

13770
Views
30
Helpful
31
Replies
Beginner

Re: Attached. Trying to do a

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

 

Beginner

Re: Attached. Trying to do a

Hello mohan88481,

How should the CSV file be?

Best Regards,
Highlighted
Beginner

Can someone tell me why

Can someone tell me why having the data in a file called items that looks like this doesn't work? I keep getting 422 errors:
[items.txt]
{ "name": "test6", "value": "1.1.1.1/24", "type": "Network" }
Looks like you are missing description item
Beginner

Nope, originally I thought it

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.

Beginner

Is not your request data

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

/usr/lib/python2.7/dist

/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.

Beginner

Re: Hamoud,

[moved]

 

Beginner

Re: Hamoud,

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.

 

 

 

Beginner

Re: Hamoud,

Hello,
Any news in this case? Is it possible to creat multiple objects with FMC 6.2 API?

Regards and thanks for all
Beginner

Re: Hamoud,

Still no bulk import of network objects in the FMC as of 6.2.2.2. Have you tried using the migration tool to import?
Beginner

Re: Multi Network Object POST

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

 

 

 

 

 

Beginner

Re: Multi Network Object POST

How many iterations is Postman using? If it's more than one, then it's not really doing a "bulk" creation of the network objects. It's using multiple calls to the api, creating only one object per api call.

This is similar to an earlier suggestion where someone said to use a for loop to iterate through a list of network objects to create one object at a time until all the objects in the list were created.
Beginner

Re: Multi Network Object POST

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!

Beginner

Re: Multi Network Object POST

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

Beginner

Re: Multi Network Object POST

Tryed your method with Postmon but I keep receiving 401 error Unauthorized, even though I've generated the toke correctly. Any tips?

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.