<?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 Add Network Object using cURL on Windows in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/add-network-object-using-curl-on-windows/m-p/5401315#M625</link>
    <description>&lt;P&gt;I'm trying to add policy objects using cURL on Windows. I keep getting error "Bad request: There was a problem in the JSON you submitted." I don't have regular access to a Linux machine but when I run this command there it's working. There are a few clients and a lot of entries I need to add and I need to do this work from a Windows computer. What am I doing wrong here?&lt;/P&gt;&lt;P&gt;From the Linux machine I use: curl -L -H 'X-Cisco-Meraki-API-Key: redacted' -H "Content-Type: application/json" -X POST --data-binary '{"name":"Test Object","category":"network", "type": "cidr","cidr":"[ip4 address'","groupIds":[]}' '&lt;A href="https://api.meraki.com/api/v1/organizations/607422999741596545/policyObjects" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.meraki.com/api/v1/organizations/[redacted]/policyObjects&lt;/A&gt;'&lt;/P&gt;&lt;P&gt;and it works:&lt;/P&gt;&lt;P&gt;From the Windows machine I use: curl -L -H "X-Cisco-Meraki-API-Key:[redacted]" -H "Content-Type:application/json" -X POST --data-binary {"name":"Test Object","category":"network","type":"cidr","cidr":"ip4 address","groupIds":"[]"} &lt;A href="https://api.meraki.com/api/v1/organizations/[redacted]/PolicyObjects" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.meraki.com/api/v1/organizations/[redacted]/PolicyObjects&lt;/A&gt; -v&lt;/P&gt;&lt;P&gt;and I get verbose results here:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Note: Unnecessary use of -X or --request, POST is already inferred.&lt;BR /&gt;* Trying 209.206.54.142...&lt;BR /&gt;* TCP_NODELAY set&lt;BR /&gt;* Connected to api.meraki.com (209.206.54.142) port 443 (#0)&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 1/3)&lt;BR /&gt;* schannel: checking server certificate revocation&lt;BR /&gt;* schannel: sending initial handshake data: sending 185 bytes...&lt;BR /&gt;* schannel: sent initial handshake data: sent 185 bytes&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 2/3)&lt;BR /&gt;* schannel: failed to receive handshake, need more data&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 2/3)&lt;BR /&gt;* schannel: encrypted data got 4017&lt;BR /&gt;* schannel: encrypted data buffer: offset 4017 length 4096&lt;BR /&gt;* schannel: sending next handshake data: sending 93 bytes...&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 2/3)&lt;BR /&gt;* schannel: encrypted data got 258&lt;BR /&gt;* schannel: encrypted data buffer: offset 258 length 4096&lt;BR /&gt;* schannel: SSL/TLS handshake complete&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 3/3)&lt;BR /&gt;* schannel: stored credential handle in session cache&lt;BR /&gt;&amp;gt; POST /api/v1/organizations/[redacted]/PolicyObjects HTTP/1.1&lt;BR /&gt;&amp;gt; Host: api.meraki.com&lt;BR /&gt;&amp;gt; User-Agent: curl/7.55.1&lt;BR /&gt;&amp;gt; Accept: */*&lt;BR /&gt;&amp;gt; X-Cisco-Meraki-API-Key:[redacted]&lt;BR /&gt;&amp;gt; Content-Type:application/json&lt;BR /&gt;&amp;gt; Content-Length: 74&lt;BR /&gt;&amp;gt;&lt;BR /&gt;* upload completely sent off: 74 out of 74 bytes&lt;BR /&gt;* schannel: client wants to read 102400 bytes&lt;BR /&gt;* schannel: encdata_buffer resized 103424&lt;BR /&gt;* schannel: encrypted data buffer: offset 0 length 103424&lt;BR /&gt;* schannel: encrypted data got 385&lt;BR /&gt;* schannel: encrypted data buffer: offset 385 length 103424&lt;BR /&gt;* schannel: decrypted data length: 356&lt;BR /&gt;* schannel: decrypted data added: 356&lt;BR /&gt;* schannel: decrypted data cached: offset 356 length 102400&lt;BR /&gt;* schannel: encrypted data buffer: offset 0 length 103424&lt;BR /&gt;* schannel: decrypted data buffer: offset 356 length 102400&lt;BR /&gt;* schannel: schannel_recv cleanup&lt;BR /&gt;* schannel: decrypted data returned 356&lt;BR /&gt;* schannel: decrypted data buffer: offset 0 length 102400&lt;BR /&gt;&amp;lt; HTTP/1.1 400 Bad Request&lt;BR /&gt;&amp;lt; Server: nginx/1.21.4&lt;BR /&gt;&amp;lt; Date: Mon, 06 Dec 2021 21:15:15 GMT&lt;BR /&gt;&amp;lt; Content-Type: */*; charset=utf-8&lt;BR /&gt;&amp;lt; Content-Length: 58&lt;BR /&gt;&amp;lt; Connection: keep-alive&lt;BR /&gt;&amp;lt; X-Request-Id: 7373e325bb2d286c34a5073594e50c08&lt;BR /&gt;&amp;lt; X-Runtime: 0.001559&lt;BR /&gt;&amp;lt; Strict-Transport-Security: max-age=15552000; includeSubDomains&lt;BR /&gt;&amp;lt;&lt;BR /&gt;Bad request: There was a problem in the JSON you submitted* Connection #0 to host api.meraki.com left intact&lt;/P&gt;</description>
    <pubDate>Mon, 06 Dec 2021 21:23:57 GMT</pubDate>
    <dc:creator>ddawson100</dc:creator>
    <dc:date>2021-12-06T21:23:57Z</dc:date>
    <item>
      <title>Add Network Object using cURL on Windows</title>
      <link>https://community.cisco.com/t5/network-platform-api/add-network-object-using-curl-on-windows/m-p/5401315#M625</link>
      <description>&lt;P&gt;I'm trying to add policy objects using cURL on Windows. I keep getting error "Bad request: There was a problem in the JSON you submitted." I don't have regular access to a Linux machine but when I run this command there it's working. There are a few clients and a lot of entries I need to add and I need to do this work from a Windows computer. What am I doing wrong here?&lt;/P&gt;&lt;P&gt;From the Linux machine I use: curl -L -H 'X-Cisco-Meraki-API-Key: redacted' -H "Content-Type: application/json" -X POST --data-binary '{"name":"Test Object","category":"network", "type": "cidr","cidr":"[ip4 address'","groupIds":[]}' '&lt;A href="https://api.meraki.com/api/v1/organizations/607422999741596545/policyObjects" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.meraki.com/api/v1/organizations/[redacted]/policyObjects&lt;/A&gt;'&lt;/P&gt;&lt;P&gt;and it works:&lt;/P&gt;&lt;P&gt;From the Windows machine I use: curl -L -H "X-Cisco-Meraki-API-Key:[redacted]" -H "Content-Type:application/json" -X POST --data-binary {"name":"Test Object","category":"network","type":"cidr","cidr":"ip4 address","groupIds":"[]"} &lt;A href="https://api.meraki.com/api/v1/organizations/[redacted]/PolicyObjects" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.meraki.com/api/v1/organizations/[redacted]/PolicyObjects&lt;/A&gt; -v&lt;/P&gt;&lt;P&gt;and I get verbose results here:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Note: Unnecessary use of -X or --request, POST is already inferred.&lt;BR /&gt;* Trying 209.206.54.142...&lt;BR /&gt;* TCP_NODELAY set&lt;BR /&gt;* Connected to api.meraki.com (209.206.54.142) port 443 (#0)&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 1/3)&lt;BR /&gt;* schannel: checking server certificate revocation&lt;BR /&gt;* schannel: sending initial handshake data: sending 185 bytes...&lt;BR /&gt;* schannel: sent initial handshake data: sent 185 bytes&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 2/3)&lt;BR /&gt;* schannel: failed to receive handshake, need more data&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 2/3)&lt;BR /&gt;* schannel: encrypted data got 4017&lt;BR /&gt;* schannel: encrypted data buffer: offset 4017 length 4096&lt;BR /&gt;* schannel: sending next handshake data: sending 93 bytes...&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 2/3)&lt;BR /&gt;* schannel: encrypted data got 258&lt;BR /&gt;* schannel: encrypted data buffer: offset 258 length 4096&lt;BR /&gt;* schannel: SSL/TLS handshake complete&lt;BR /&gt;* schannel: SSL/TLS connection with api.meraki.com port 443 (step 3/3)&lt;BR /&gt;* schannel: stored credential handle in session cache&lt;BR /&gt;&amp;gt; POST /api/v1/organizations/[redacted]/PolicyObjects HTTP/1.1&lt;BR /&gt;&amp;gt; Host: api.meraki.com&lt;BR /&gt;&amp;gt; User-Agent: curl/7.55.1&lt;BR /&gt;&amp;gt; Accept: */*&lt;BR /&gt;&amp;gt; X-Cisco-Meraki-API-Key:[redacted]&lt;BR /&gt;&amp;gt; Content-Type:application/json&lt;BR /&gt;&amp;gt; Content-Length: 74&lt;BR /&gt;&amp;gt;&lt;BR /&gt;* upload completely sent off: 74 out of 74 bytes&lt;BR /&gt;* schannel: client wants to read 102400 bytes&lt;BR /&gt;* schannel: encdata_buffer resized 103424&lt;BR /&gt;* schannel: encrypted data buffer: offset 0 length 103424&lt;BR /&gt;* schannel: encrypted data got 385&lt;BR /&gt;* schannel: encrypted data buffer: offset 385 length 103424&lt;BR /&gt;* schannel: decrypted data length: 356&lt;BR /&gt;* schannel: decrypted data added: 356&lt;BR /&gt;* schannel: decrypted data cached: offset 356 length 102400&lt;BR /&gt;* schannel: encrypted data buffer: offset 0 length 103424&lt;BR /&gt;* schannel: decrypted data buffer: offset 356 length 102400&lt;BR /&gt;* schannel: schannel_recv cleanup&lt;BR /&gt;* schannel: decrypted data returned 356&lt;BR /&gt;* schannel: decrypted data buffer: offset 0 length 102400&lt;BR /&gt;&amp;lt; HTTP/1.1 400 Bad Request&lt;BR /&gt;&amp;lt; Server: nginx/1.21.4&lt;BR /&gt;&amp;lt; Date: Mon, 06 Dec 2021 21:15:15 GMT&lt;BR /&gt;&amp;lt; Content-Type: */*; charset=utf-8&lt;BR /&gt;&amp;lt; Content-Length: 58&lt;BR /&gt;&amp;lt; Connection: keep-alive&lt;BR /&gt;&amp;lt; X-Request-Id: 7373e325bb2d286c34a5073594e50c08&lt;BR /&gt;&amp;lt; X-Runtime: 0.001559&lt;BR /&gt;&amp;lt; Strict-Transport-Security: max-age=15552000; includeSubDomains&lt;BR /&gt;&amp;lt;&lt;BR /&gt;Bad request: There was a problem in the JSON you submitted* Connection #0 to host api.meraki.com left intact&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 21:23:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/add-network-object-using-curl-on-windows/m-p/5401315#M625</guid>
      <dc:creator>ddawson100</dc:creator>
      <dc:date>2021-12-06T21:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add Network Object using cURL on Windows</title>
      <link>https://community.cisco.com/t5/network-platform-api/add-network-object-using-curl-on-windows/m-p/5401316#M626</link>
      <description>&lt;P&gt;I've just spent the best part of two hours with Windows and CURL, and, FINALLY had some success.&lt;/P&gt;&lt;P&gt;However, I'm not going to be able to EXACTLY answer your question, but wanted to help you on the way:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;curl --get -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Cisco-Meraki-API-Key: 65656565656565656565" https://api.meraki.com/api/v1/organizations&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is a simple "Get Orgs" API call&lt;/P&gt;&lt;P&gt;The issue I see with your code is that Windows is painfully picky with escaping double quotes and stuff. I visibly grew old trying to get it to work, and gave up.&lt;/P&gt;&lt;P&gt;What I did achieve, however, was to put the body into a file called &lt;STRONG&gt;body.json&lt;/STRONG&gt; on my desktop. Nothing is escaped in here, other than the JSON I'm included &lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-01-31 at 4.36.00 PM.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/262559iFD46B820B9D84B2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;And to simplify things, I then issued the following command:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;curl https://api.meraki.com/api/v1/networks/N_56565656565656565/webhooks/payloadTemplates --header "Content-Type: application/json" --header "Accept: application/json" --header "X-Cisco-Meraki-API-Key: 5656565656565656" --data "@C:\Users\Meraki Admin\Desktop\body.json"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;MUCH easier. If you literally replicated EVERYTHING above and placed:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt; {"name":"Test Object","category":"network","type":"cidr","cidr":"ip4 address","groupIds":"[]"}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; into the &lt;STRONG&gt;body.json&lt;/STRONG&gt; you should have some success&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 16:39:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/add-network-object-using-curl-on-windows/m-p/5401316#M626</guid>
      <dc:creator>Arthur Dent</dc:creator>
      <dc:date>2023-01-31T16:39:21Z</dc:date>
    </item>
  </channel>
</rss>

