<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Multi Network Object POST in Network Security</title>
    <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3374065#M1008108</link>
    <description>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.&lt;BR /&gt;&lt;BR /&gt;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.</description>
    <pubDate>Thu, 26 Apr 2018 20:52:20 GMT</pubDate>
    <dc:creator>michoudi</dc:creator>
    <dc:date>2018-04-26T20:52:20Z</dc:date>
    <item>
      <title>Multi Network Object POST</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037021#M1008074</link>
      <description>&lt;P&gt;Dear Support,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;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 :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;under network i POST the below configuration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://xxx.xxx.xxx.xxx/api/fmc_config/v1/domain/" target="_blank"&gt;https://xxx.xxx.xxx.xxx/api/fmc_config/v1/domain/&lt;/A&gt;&lt;SPAN style="text-decoration: line-through;"&gt;e233abec-e0f2-11e3-2321-6d9ed49b625f&lt;/SPAN&gt;/object/networks&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Body:&lt;/P&gt;
&lt;P&gt;-----------------------&lt;/P&gt;
&lt;P&gt;{&lt;BR /&gt;"name":"testing",&lt;BR /&gt;"type":"Network",&lt;BR /&gt;"description": "testing",&lt;BR /&gt;"value": "2.2.90.0/24"&lt;BR /&gt;},&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"name":"testing2",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"type":"Network",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"description": "testing2",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"value": "2.2.91.0/24"&lt;/SPAN&gt;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;----------------&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;it return with&amp;nbsp;Syntax errors.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;can you please provide me with right way to POST multi network Object or any kind of configuration through REST API.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;BR,&lt;/P&gt;
&lt;P&gt;Hamoud Hamdan&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 13:16:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037021#M1008074</guid>
      <dc:creator>hamoudud1</dc:creator>
      <dc:date>2019-03-12T13:16:55Z</dc:date>
    </item>
    <item>
      <title>Hamoud,</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037022#M1008075</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Verdana;"&gt;Hamoud,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Verdana;"&gt;Multi import will not be possible until the next release. Currently if you want to create multiple objects you need to make individual calls with a single object in each JSON payload.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Verdana;"&gt;The best way to do multiple objects, today, &amp;nbsp;would be to build a large JSON file with all your objects and script iteration over the entire file and make individual calls object in the JSON.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If you haven't already spend some time in the API explorer&amp;nbsp;@ &lt;A href="https://&amp;lt;&amp;lt;FMC" target="_blank"&gt;https://&amp;lt;&amp;lt;FMC&lt;/A&gt; IP&amp;gt;&amp;gt;/api/api-explorer it is a great place to see the calls you can make as well as gather example scripts/JSON for all the calls.&lt;/P&gt;
&lt;P&gt;-Neil&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 15:14:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037022#M1008075</guid>
      <dc:creator>neipatel</dc:creator>
      <dc:date>2017-02-07T15:14:57Z</dc:date>
    </item>
    <item>
      <title>Dear Neipatel,</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037023#M1008076</link>
      <description>&lt;P&gt;Dear Neipatel,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your assist.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Can you share with me small example or more information about building large JSON file with all your objects and script iteration over the entire file and make individual calls object in the JSON.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;BR,&lt;/P&gt;
&lt;P&gt;Hamoud Hamdan&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 08:48:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037023#M1008076</guid>
      <dc:creator>hamoudud1</dc:creator>
      <dc:date>2017-02-08T08:48:32Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037024#M1008077</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;COuld you post your sample for one POST network&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;After that, I think the idea is to adapt something like this :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;for i in file["...""..."]:&lt;BR /&gt;&amp;nbsp;yourPostMethod(i[name];i[value])&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 14:04:19 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037024#M1008077</guid>
      <dc:creator>ssambourg</dc:creator>
      <dc:date>2017-03-24T14:04:19Z</dc:date>
    </item>
    <item>
      <title>Hamoud,</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037025#M1008078</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hamoud,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;An high level pseudo code example would be as follows:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;JSON of the Network Objects:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;networks = [{name: objecta,&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; value: 10.0.0.0/24,&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; type: Network},&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;{name: objectb,&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; value: 20.0.0.0/24,&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; type: Network},&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;{name: objectc,&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; value: 30.0.0.0/24,&lt;/P&gt;
&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; type: Network}]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Code to iterate and make posts:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;for &lt;STRONG&gt;object&lt;/STRONG&gt; in &lt;STRONG&gt;networks&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;*post object to fmc&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;
&lt;P&gt;this way the loop will go through each object and post them one at a time.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;-Neil&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 14:54:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037025#M1008078</guid>
      <dc:creator>neipatel</dc:creator>
      <dc:date>2017-03-24T14:54:42Z</dc:date>
    </item>
    <item>
      <title>Is there a way to post the</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037026#M1008079</link>
      <description>&lt;P&gt;Is there a way to post the body argument in request :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;url = "https://%s/api/fmc_platform/v1/auth/generatetoken" % ipaddr&lt;/P&gt;
&lt;P&gt;results=[]&lt;/P&gt;
&lt;P&gt;headers = {&lt;BR /&gt; 'cache-control': "no-cache",&lt;BR /&gt; 'postman-token': "ff30c506-4739-9d4d-2e53-0dc7efc2036a"&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;response = requests.request("POST", url, headers=headers, auth=(user1,pass1), verify=False)&lt;/P&gt;
&lt;P&gt;# Authenicates token used in addiotnal HTTPS CRUD request&lt;BR /&gt;auth = response.headers['X-auth-access-token']&lt;/P&gt;
&lt;P&gt;body= {&lt;BR /&gt;"name":"TEST",&lt;BR /&gt;"type":"Network",&lt;BR /&gt;"description": "TEST",&lt;BR /&gt;"value": "1.2.3.4"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;headers = {&lt;BR /&gt; 'x-auth-access-token': auth,&lt;BR /&gt; 'cache-control': "no-cache",&lt;BR /&gt; 'postman-token': "ff30c506-4739-9d4d-2e53-0dc7efc2036a"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;url = "https://%s/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/object/hosts" % ipaddr&lt;/P&gt;
&lt;P&gt;querystring = {"limit":"1000"}&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;print(headers['x-auth-access-token'])&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;response = requests.request("POST", url, headers=headers, auth=(user1,pass1), &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;body=body&lt;/STRONG&gt;&lt;/SPAN&gt;, verify=False)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;My single network add doens't work.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 15:05:49 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037026#M1008079</guid>
      <dc:creator>ssambourg</dc:creator>
      <dc:date>2017-03-24T15:05:49Z</dc:date>
    </item>
    <item>
      <title>It should be posted as a data</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037027#M1008080</link>
      <description>&lt;P&gt;It should be posted as a data field. I have attached an example function.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 15:11:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037027#M1008080</guid>
      <dc:creator>neipatel</dc:creator>
      <dc:date>2017-03-24T15:11:18Z</dc:date>
    </item>
    <item>
      <title>Thanks that's better.</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037028#M1008083</link>
      <description>&lt;P&gt;Thanks that's better.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I didn't find the way to load in json format correctly this file :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;My code :&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;#Retrieve JSON file passed in execution argument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; inputNetworkObjFile = open(sys.argv[1], "rb")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; readedFile = inputNetworkObjFile.read()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; i = 1&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; #Troubleshoot test printing readed input file : OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; print(readedFile)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # if logFile :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # for netObj in readedFile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # networkPOST(headers,uuid,server,netObj)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # logFile.write("Network Obj : %d",i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # i++&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # logFile.write("NAME : %s",netObj[0])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # logFile.write("VALUE : %s",netObj[1])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # logFile.write("TYPE : %s",netObj[2])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # logFile.write("DESCRIPTION : %s",netObj[2])&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # if inputNetworkObjFile: inputNetworkObjFile.close()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt; # else&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;My output :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;b'networkObjects = \r\n[\r\n\t{"name": "network_A",\r\n\t"value": "10.0.0.0/8",\&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;r\n\t"type": "Network",\r\n\t"description":"objecta"},\r\n\r\n\t{"name": "networ&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;k_B",\r\n\t"value": "172.16.0.0/12",\r\n\t"type": "Network",\r\n\t"description":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;"objecta"},\r\n\t\r\n\t{"name": "network_C",\r\n\t"value": "192.168.0/16",\r\n\t&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;"type": "Network",\r\n\t"description":"objecta"}\r\n]'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;I&amp;nbsp;also try to get this way for my code :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;#Retrieve JSON file passed in execution argument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;inputNetworkObjFile = open(sys.argv[1], "rb")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;readedFile = inputNetworkObjFile.read()&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;datas = json.dumps(&lt;SPAN&gt;readedFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;i = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;#Troubleshoot test printing readed input file : OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 10pt;"&gt;print(readedFile)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;then mak a call to the datas variable in the for loop but always this kind of error :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt; File "test3.py", line 102&lt;BR /&gt; for netObj in readedFile&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt;Do you have an example parsing JSON file code ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2017 17:27:59 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037028#M1008083</guid>
      <dc:creator>ssambourg</dc:creator>
      <dc:date>2017-03-25T17:27:59Z</dc:date>
    </item>
    <item>
      <title>It looks like you are using</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037029#M1008084</link>
      <description>&lt;P&gt;It looks like you are using some sort of log file write and populating it with tabs/new lines to create your JSON. It is much easier and recommended to used the built in Python JSON handling libraries to ensure there are not formatting errors in it.&lt;/P&gt;
&lt;P&gt;https://docs.python.org/2/library/json.html&lt;/P&gt;
&lt;P&gt;This way when you read the json back again it will be index-able as it should like a dictionary.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 13:26:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037029#M1008084</guid>
      <dc:creator>neipatel</dc:creator>
      <dc:date>2017-03-29T13:26:32Z</dc:date>
    </item>
    <item>
      <title>Hey Neil, long time. ;) Hey</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037030#M1008086</link>
      <description>&lt;P&gt;&lt;G class="gr_ gr_21 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="21" data-gr-id="21"&gt;Hey&lt;/G&gt; Neil, long time. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;G class="gr_ gr_72 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" id="72" data-gr-id="72"&gt;Hey&lt;/G&gt; is the bulk post working in 6.2.1 of FPM? Is there a script anyone has lying around for this?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 19:42:30 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037030#M1008086</guid>
      <dc:creator>babiojd01</dc:creator>
      <dc:date>2017-08-08T19:42:30Z</dc:date>
    </item>
    <item>
      <title>I have one, I used CSV</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037031#M1008088</link>
      <description>&lt;P&gt;I have one, I used CSV containing host objects as input and used the loop to post each row (Object) to FMC API, but could not make more than 120 requests per minute, which is currently registered as enhancement bug. Let me know if this is something you are looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 16:59:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037031#M1008088</guid>
      <dc:creator>mohanB</dc:creator>
      <dc:date>2017-08-09T16:59:17Z</dc:date>
    </item>
    <item>
      <title>Yea, that would be great. Ty.</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037032#M1008089</link>
      <description>&lt;DIV&gt;Yea, that would be great. Ty. 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:&lt;/DIV&gt;
&lt;DIV&gt;[items.txt]&lt;/DIV&gt;
&lt;DIV&gt;{ "name": "test6", "value": "1.1.1.1/24", "type": "Network" }&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Post operation inside of my python script.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;post_data = open("items.txt","r")&lt;BR /&gt;for line in post_data:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print line&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # REST call with SSL verification turned off:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r = requests.post(url, data=json.dumps(line), headers=headers, verify=False)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # REST call with SSL verification turned on:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #r = requests.post(url, data=json.dumps(post_data), headers=headers, verify='/path/to/ssl_certificate')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_code = r.status_code&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resp = r.text&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Status code is: "+str(status_code))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if status_code == 201 or status_code == 202:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("Post was successful...")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; json_resp = json.loads(resp)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else :&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.raise_for_status()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("Error occurred in POST --&amp;gt; "+resp)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except requests.exceptions.HTTPError as err:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("Error in connection --&amp;gt; "+str(err))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if r: r.close()&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:06:12 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037032#M1008089</guid>
      <dc:creator>babiojd01</dc:creator>
      <dc:date>2017-08-09T17:06:12Z</dc:date>
    </item>
    <item>
      <title>Attached. Trying to do a</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037033#M1008092</link>
      <description>&lt;P&gt;Attached. Trying to do a similar script for network group, have been challenging because of my little python knowledge.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this one works for you, I tested it first, which I would recommend.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;PRE class="prettyprint"&gt;# to run from terminal, type &amp;lt;Python test.py sample.csv&amp;gt;&lt;BR /&gt;# use at your own risk&lt;BR /&gt;#sample.csv&lt;BR /&gt;#name,type,value,description&lt;BR /&gt;#test,Host,10.20.19.235,test&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;BR /&gt;import json&lt;BR /&gt;import requests&lt;BR /&gt;import csv&lt;BR /&gt;import sys&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;server = "https://FMC IP"&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;username = "Fill here"&lt;BR /&gt;password = "Fill Here"&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;BR /&gt;r = None&lt;BR /&gt;headers = {'Content-Type': 'application/json'}&lt;BR /&gt;api_auth_path = "/api/fmc_platform/v1/auth/generatetoken"&lt;BR /&gt;auth_url = server + api_auth_path&lt;BR /&gt;try:&lt;BR /&gt; # 2 ways of making a REST call are provided:&lt;BR /&gt; # One with "SSL verification turned off" and the other with "SSL verification turned on".&lt;BR /&gt; # The one with "SSL verification turned off" is commented out. If you like to use that then&lt;BR /&gt; # uncomment the line where verify=False and comment the line with =verify='/path/to/ssl_certificate'&lt;BR /&gt; # REST call with SSL verification turned off:&lt;BR /&gt; r = requests.post(auth_url, headers=headers, auth=requests.auth.HTTPBasicAuth(username, password), verify=False)&lt;BR /&gt; # REST call with SSL verification turned on: Download SSL certificates from your FMC first and provide its path for verification.&lt;BR /&gt; # r = requests.post(auth_url, headers=headers, auth=requests.auth.HTTPBasicAuth(username,password), verify='/path/to/ssl_certificate')&lt;BR /&gt; auth_headers = r.headers&lt;BR /&gt; auth_token = auth_headers.get('X-auth-access-token', default=None)&lt;BR /&gt; if auth_token == None:&lt;BR /&gt; print("auth_token not found. Exiting...")&lt;BR /&gt; sys.exit()&lt;BR /&gt;except Exception as err:&lt;BR /&gt; print ("Error in generating auth token --&amp;gt; " + str(err))&lt;BR /&gt; sys.exit()&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;headers['X-auth-access-token'] = auth_token&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;api_path = "/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/object/hosts" # param&lt;BR /&gt;url = server + api_path&lt;BR /&gt;if (url[-1] == '/'):&lt;BR /&gt; url = url[:-1]&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;BR /&gt;# POST OPERATION&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;# Function to convert a csv file to a list of dictionaries. Takes in one variable called "variables_file"&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;def csv_dict_list(variables_file):&lt;BR /&gt; # Open variable-based csv, iterate over the rows and map values to a list of dictionaries containing key/value pairs&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;reader = csv.DictReader(open(variables_file, 'rb'))&lt;BR /&gt; dict_list = []&lt;BR /&gt; for line in reader:&lt;BR /&gt; dict_list.append(line)&lt;BR /&gt; return dict_list&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;BR /&gt;# Calls the csv_dict_list function, passing the named csv&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;object_dict = csv_dict_list(sys.argv[1])&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;for post_data in object_dict:&lt;BR /&gt; try:&lt;BR /&gt; # REST call with SSL verification turned off:&lt;BR /&gt; r = requests.post(url, data=json.dumps(post_data), headers=headers, verify=False)&lt;BR /&gt; # REST call with SSL verification turned on:&lt;BR /&gt; # r = requests.post(url, data=json.dumps(post_data), headers=headers, verify='/path/to/ssl_certificate')&lt;BR /&gt; status_code = r.status_code&lt;BR /&gt; resp = r.text&lt;BR /&gt; print("Status code is: " + str(status_code))&lt;BR /&gt; if status_code == 201 or status_code == 202:&lt;BR /&gt; print ("Post was successful...")&lt;BR /&gt; json_resp = json.loads(resp)&lt;BR /&gt; print(json.dumps(json_resp, sort_keys=True, indent=4, separators=(',', ': ')))&lt;BR /&gt; else:&lt;BR /&gt; r.raise_for_status()&lt;BR /&gt; print ("Error occurred in POST --&amp;gt; " + resp)&lt;BR /&gt; except requests.exceptions.HTTPError as err:&lt;BR /&gt; print ("Error in connection --&amp;gt; " + str(err))&lt;BR /&gt; finally:&lt;BR /&gt; if r: r.close()&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;/PRE&gt;
&lt;PRE class="prettyprint"&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:26:05 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037033#M1008092</guid>
      <dc:creator>mohanB</dc:creator>
      <dc:date>2017-08-09T17:26:05Z</dc:date>
    </item>
    <item>
      <title>Can someone tell me why</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037034#M1008095</link>
      <description>&lt;H6&gt;Can someone tell me why having the data in a file called items that &lt;G class="gr_ gr_6 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" id="6" data-gr-id="6"&gt;looks&lt;/G&gt; like this doesn't work? I keep getting 422 errors:&lt;/H6&gt;
&lt;H6&gt;[items.txt]&lt;/H6&gt;
&lt;H6&gt;{ "name": "test6", "value": "1.1.1.1/24", "type": "Network" }&lt;/H6&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;Looks like you are missing description&amp;nbsp;item&lt;/STRONG&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:28:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037034#M1008095</guid>
      <dc:creator>mohanB</dc:creator>
      <dc:date>2017-08-09T17:28:10Z</dc:date>
    </item>
    <item>
      <title>Nope, originally I thought it</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037035#M1008096</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 18:36:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037035#M1008096</guid>
      <dc:creator>babiojd01</dc:creator>
      <dc:date>2017-08-09T18:36:58Z</dc:date>
    </item>
    <item>
      <title>Is not your request data</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037036#M1008097</link>
      <description>&lt;P&gt;Is not your request data should look like this?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;PRE class="prettyprint"&gt;{ &lt;SPAN class="string"&gt;"name":&lt;/SPAN&gt; &lt;SPAN class="string"&gt;"Test6"&lt;/SPAN&gt;, &lt;SPAN class="string"&gt;"type":&lt;/SPAN&gt; &lt;SPAN class="string"&gt;"Network"&lt;/SPAN&gt;, &lt;SPAN class="string"&gt;"value":&lt;/SPAN&gt; &lt;SPAN class="string"&gt;"1.1.1.0/24"&lt;/SPAN&gt;, &lt;SPAN class="string"&gt;"description":&lt;/SPAN&gt; &lt;SPAN class="string"&gt;"Test Description"&lt;/SPAN&gt;&amp;nbsp;}&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;PRE class="prettyprint"&gt;&lt;SPAN&gt;{ "name": "test6", "value": "1.1.1.1/24", "type": "Network" }&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2017 18:49:52 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037036#M1008097</guid>
      <dc:creator>mohanB</dc:creator>
      <dc:date>2017-08-09T18:49:52Z</dc:date>
    </item>
    <item>
      <title>/usr/lib/python2.7/dist</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037037#M1008098</link>
      <description>&lt;P&gt;/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: &lt;A href="https://urllib3.readthedocs.org/en/latest/security.html" target="_blank"&gt;https://urllib3.readthedocs.org/en/latest/security.html&lt;/A&gt;&lt;BR /&gt; InsecureRequestWarning)&lt;BR /&gt;{ "name": "Test6", "type": "Network", "value": "1.1.1.0/24", "description": "Test Description" }&lt;/P&gt;
&lt;P&gt;Status code is: 422&lt;/P&gt;
&lt;P&gt;Nope still doesn't like it. I get this every time.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 19:04:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037037#M1008098</guid>
      <dc:creator>babiojd01</dc:creator>
      <dc:date>2017-08-09T19:04:36Z</dc:date>
    </item>
    <item>
      <title>[items.txt]</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037038#M1008099</link>
      <description>&lt;P style="padding-left: 30px;"&gt;[items.txt]&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;{ "name":"Test29","value":"1.1.1.0/24","type":"Network" }&lt;BR /&gt;{ "name":"Test28","value":"1.1.2.0/24","type":"Network" }&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;with open('items.txt') as f:&lt;/P&gt;
&lt;P style="padding-left: 60px;"&gt;for line in f:&lt;/P&gt;
&lt;P style="padding-left: 60px;"&gt;j_content = json.loads(line)&lt;/P&gt;
&lt;P style="padding-left: 60px;"&gt;try:&lt;BR /&gt; # REST call with SSL verification turned off:&lt;BR /&gt; r = requests.post(url, data=json.dumps(j_content), headers=headers, verify=False)&lt;BR /&gt; # REST call with SSL verification turned on:&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;This works iterating through the lines in the text file. Enjoy!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 23:34:34 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3037038#M1008099</guid>
      <dc:creator>babiojd01</dc:creator>
      <dc:date>2017-08-10T23:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hamoud,</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3224993#M1008100</link>
      <description>&lt;P&gt;Dear Neipatel,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is:&lt;/P&gt;
&lt;P&gt;-&amp;nbsp;All the examples that I found on the Cisco site show how to post a single object&lt;/P&gt;
&lt;P&gt;- The limitation of 120 requests by minutes break my loop&lt;/P&gt;
&lt;P&gt;- I'm unable to find a correct and a exact syntax of the&amp;nbsp;JSON body that I need to insert into my API request for post some objects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First of all I would like to know if it's definitely possible to insert some objects in the same API request.&lt;/P&gt;
&lt;P&gt;If it's possible,&amp;nbsp;&lt;SPAN&gt;can someone give me the simplest possible example in python language or the syntax in JSON that I&amp;nbsp;have to insert in my python code.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tanks for all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 11:09:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3224993#M1008100</guid>
      <dc:creator>Orhan.T</dc:creator>
      <dc:date>2017-11-30T11:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Attached. Trying to do a</title>
      <link>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3302273#M1008101</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the next issue, when I run the next commands:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;python prueba.py Prueba.csv&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;File "prueba.py", line 59&lt;BR /&gt; reader = csv.DictReader(open(variables_file, 'rb'))&lt;BR /&gt; ^&lt;BR /&gt;IndentationError: expected an indented block&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;***************************************************************&lt;/P&gt;
&lt;P&gt;This is the code of python, the file "prueba.csv" contains the next:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prueba.CSV&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="80" height="20" align="left" style="height: 15.0pt; width: 60pt;"&gt;name&lt;/TD&gt;
&lt;TD width="80" align="left" style="width: 60pt;"&gt;type&lt;/TD&gt;
&lt;TD width="80" align="left" style="width: 60pt;"&gt;value&lt;/TD&gt;
&lt;TD width="80" align="left" style="width: 60pt;"&gt;description&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="left" style="height: 15.0pt;"&gt;test&lt;/TD&gt;
&lt;TD align="left"&gt;Network&lt;/TD&gt;
&lt;TD align="left"&gt;6.6.6.0/24&lt;/TD&gt;
&lt;TD align="left"&gt;test&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prueba.py&lt;/P&gt;
&lt;P&gt;# to run from terminal, type &amp;lt;Python test.py sample.csv&amp;gt;&lt;BR /&gt;# use at your own risk&lt;BR /&gt;#sample.csv&lt;BR /&gt;#name,type,value,description&lt;BR /&gt;#test,Host,10.20.19.235,test&lt;/P&gt;
&lt;P&gt;import csv&lt;BR /&gt;import sys&lt;BR /&gt;import json&lt;BR /&gt;import requests&lt;BR /&gt;import time&lt;/P&gt;
&lt;P&gt;server = "&lt;A href="https://192.168.90.181" target="_blank"&gt;https://192.168.90.181&lt;/A&gt;"&lt;/P&gt;
&lt;P&gt;# Modify the username as required&lt;BR /&gt;username = "admin"&lt;BR /&gt;if len(sys.argv) &amp;gt; 1:&lt;BR /&gt; username = sys.argv[1]&lt;/P&gt;
&lt;P&gt;#Modify the password as required&lt;BR /&gt;password = "securesoft"&lt;BR /&gt;if len(sys.argv) &amp;gt; 2:&lt;BR /&gt; password = sys.argv[2]&lt;/P&gt;
&lt;P&gt;r = None&lt;BR /&gt;headers = {'Content-Type': 'application/json'}&lt;/P&gt;
&lt;P&gt;#Create the URL&lt;BR /&gt;api_auth_path = "/api/fmc_platform/v1/auth/generatetoken"&lt;BR /&gt;auth_url = server + api_auth_path&lt;BR /&gt;try:&lt;BR /&gt; # Download SSL certificates from your FMC first and provide its path for verification.&lt;BR /&gt; r = requests.post(auth_url, headers=headers, auth=requests.auth.HTTPBasicAuth(username,password), verify=False)&lt;BR /&gt; auth_headers = r.headers&lt;BR /&gt; auth_token = auth_headers.get('X-auth-access-token', default=None)&lt;BR /&gt; if auth_token == None:&lt;BR /&gt; print("auth_token not found. Exiting...")&lt;BR /&gt; print(auth_headers)&lt;BR /&gt; sys.exit()&lt;BR /&gt;except Exception as err:&lt;BR /&gt; print ("Error in generating auth token --&amp;gt; "+str(err))&lt;BR /&gt; sys.exit()&lt;BR /&gt; &lt;BR /&gt;headers['X-auth-access-token'] = auth_token&lt;/P&gt;
&lt;P&gt;api_path = "/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/object/networks" # param&lt;BR /&gt;url = server + api_path&lt;BR /&gt;if (url[-1] == '/'):&lt;BR /&gt; url = url[:-1]&lt;BR /&gt; &lt;BR /&gt;# POST OPERATION&lt;BR /&gt;# Function to convert a csv file to a list of dictionaries. Takes in one variable called "variables_file"&lt;BR /&gt;def csv_dict_list(variables_file):&lt;/P&gt;
&lt;P&gt;# Open variable-based csv, iterate over the rows and map values to a list of dictionaries containing key/value pairs&lt;BR /&gt;#print ("Prueba2 --&amp;gt; ")&lt;BR /&gt;#sys.exit()&lt;/P&gt;
&lt;P&gt;reader = csv.DictReader(open(variables_file, 'rb'))&lt;BR /&gt; dict_list = []&lt;BR /&gt; for line in reader:&lt;BR /&gt; dict_list.append(line)&lt;BR /&gt; return dict_list&lt;BR /&gt; &lt;BR /&gt;#print ("Prueba3 --&amp;gt; ")&lt;BR /&gt;#sys.exit()&lt;/P&gt;
&lt;P&gt;# Calls the csv_dict_list function, passing the named csv&lt;BR /&gt;object_dict = csv_dict_list(sys.argv[1])&lt;BR /&gt;#pprint.pprint(object_dict)&lt;/P&gt;
&lt;P&gt;for post_data in object_dict:&lt;BR /&gt; try:&lt;BR /&gt; # REST call with SSL verification turned off:&lt;BR /&gt; r = requests.post(url, data=json.dumps(post_data), headers=headers, verify=False)&lt;BR /&gt; # REST call with SSL verification turned on:&lt;BR /&gt; # r = requests.post(url, data=json.dumps(post_data), headers=headers, verify='/path/to/ssl_certificate')&lt;BR /&gt; status_code = r.status_code&lt;BR /&gt; resp = r.text&lt;BR /&gt; print("Status code is: " + str(status_code))&lt;BR /&gt; if status_code == 201 or status_code == 202:&lt;BR /&gt; print ("Post was successful...")&lt;BR /&gt; json_resp = json.loads(resp)&lt;BR /&gt; print(json.dumps(json_resp, sort_keys=True, indent=4, separators=(',', ': ')))&lt;BR /&gt; else:&lt;BR /&gt; r.raise_for_status()&lt;BR /&gt; print ("Error occurred in POST --&amp;gt; " + resp)&lt;BR /&gt; except requests.exceptions.HTTPError as err:&lt;BR /&gt; print ("Error in connection --&amp;gt; " + str(err))&lt;BR /&gt; finally:&lt;BR /&gt; if r: r.close()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2017 16:01:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/multi-network-object-post/m-p/3302273#M1008101</guid>
      <dc:creator>jhoel_lucero</dc:creator>
      <dc:date>2017-12-26T16:01:47Z</dc:date>
    </item>
  </channel>
</rss>

