<?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: Panorama rest-api edit security policy post rule - 400 Unexpected here in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459179#M101974</link>
    <description>&lt;P&gt;You may also test using Ansible as it is generally more tested in my view:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.ansible.com/integrations/networks/palo-alto" target="_blank"&gt;Palo Alto Networks and Ansible&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://live.paloaltonetworks.com/t5/automation-api-discussions/updating-a-portion-of-the-rule-ansible/td-p/318575" target="_blank"&gt;Solved: LIVEcommunity - updating a portion of the rule - ansible - LIVEcommunity - 318575 (paloaltonetworks.com)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jan 2022 08:06:39 GMT</pubDate>
    <dc:creator>nikoolayy1</dc:creator>
    <dc:date>2022-01-18T08:06:39Z</dc:date>
    <item>
      <title>Panorama rest-api edit security policy post rule - 400 Unexpected here</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/458580#M101917</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing a python script to change the security profile for any security policy rule that is using that profile (very tedious to manually click through hundreds of policys via GUI). Panorama rest-api is always throwing a 400 response to me:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;URL query parameters and response:&lt;/P&gt;&lt;P&gt;location=device-group&amp;amp;device-group=firewall-fw&amp;amp;name=rule-test&lt;/P&gt;&lt;PRE&gt;{"code":3,"message":"Invalid Object","details":[{"@type":"CauseInfo","causes":[{"code":12,"module":"panui_mgmt","description":"Invalid Object: rule-test -&amp;gt; destination: unexpected here."}]}]}&lt;BR /&gt;400&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Json-template:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;    &lt;SPAN&gt;"entry"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;[&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        {&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"@location"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"device-group"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"@device-group"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;vsys&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"@name"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;name&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"from"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;"member"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;fromzone&lt;BR /&gt;            &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"to"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;"member"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;tozone&lt;BR /&gt;            &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"source"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;"member"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;source&lt;BR /&gt;            &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"destination"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;"member"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;destination&lt;BR /&gt;            &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"service"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;"member"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;service&lt;BR /&gt;            &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"application"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;"member"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;application&lt;BR /&gt;            &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;            &lt;SPAN&gt;"action"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;policy&lt;SPAN&gt;.&lt;/SPAN&gt;action&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;}&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    ]&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;Any tips would be appreciated!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 16:36:37 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/458580#M101917</guid>
      <dc:creator>eriryd</dc:creator>
      <dc:date>2022-02-03T16:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Panorama rest-api edit security policy post rule - 400 Unexpected here</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459060#M101964</link>
      <description>&lt;P&gt;Try debugging it :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.paloaltonetworks.com/saas-security/saas-security-admin/saas-security-api/syslog-and-api-integration/api-client-integration/public-api-references/http-request-methods-and-status-codes" target="_blank"&gt;HTTP Request Methods and Status Codes (paloaltonetworks.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.paloaltonetworks.com/pan-os/9-1/pan-os-panorama-api/get-started-with-the-pan-os-rest-api/pan-os-rest-api-request-response-structure" target="_blank"&gt;PAN-OS REST API Request and Response Structure (paloaltonetworks.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000CmA9CAK" target="_blank"&gt;How to Run a PAN-OS Web UI Debug - Knowledge Base - Palo Alto Networks&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I think you have errors in what you have written so see the example here as for example the device group in query and the the json body does not match etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.paloaltonetworks.com/pan-os/9-0/pan-os-panorama-api/get-started-with-the-pan-os-rest-api/work-with-policy-rules-on-panorama-rest-api.html" target="_blank"&gt;Work with Policy Rules on Panorama (REST API) (paloaltonetworks.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hljs-attribute"&gt;curl&lt;/SPAN&gt;&lt;SPAN&gt; -X PUT \ &lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;'&lt;A href="http://10.1.1.7/restapi/9.0/Policies/SecurityPreRules?LOCATION=device-group&amp;amp;device-group=devicegroup-7&amp;amp;name=allow-dns" target="_blank"&gt;http://10.1.1.7/restapi/9.0/Policies/SecurityPreRules?LOCATION=device-group&amp;amp;device-group=devicegroup-7&amp;amp;name=allow-dns&lt;/A&gt;'&lt;/SPAN&gt;&lt;SPAN&gt; \ -H &lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;'X-PAN-KEY: LUFRPT='&lt;/SPAN&gt;&lt;SPAN&gt; \ -d &lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;'{ "entry": [ { "&lt;SPAN class="hljs-variable"&gt;@device&lt;/SPAN&gt;-group": "devicegroup-7", "&lt;SPAN class="hljs-variable"&gt;@location&lt;/SPAN&gt;": "device-group", "&lt;SPAN class="hljs-variable"&gt;@name&lt;/SPAN&gt;": "allow-dns", "action": "allow", "application": { "member": [ "dns" ] },&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 15:58:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459060#M101964</guid>
      <dc:creator>nikoolayy1</dc:creator>
      <dc:date>2022-01-17T15:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Panorama rest-api edit security policy post rule - 400 Unexpected here</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459073#M101966</link>
      <description>&lt;P&gt;I'll try debugging it, thanks for the links!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"But I think you have errors in what you have written so see the example here as for example the device group in query and the the json body does not match etc."&lt;BR /&gt;&lt;BR /&gt;I should hade clarified that I'm also using pan-os-python (pan-os-python.readthedocs.io), I'm using the class SecurityRule to get all security rules from a firewall. The variables in my json-body are parameters from the SecurityRule class:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;policy.vsys, policy.source, policy.destination&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 17:12:16 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459073#M101966</guid>
      <dc:creator>eriryd</dc:creator>
      <dc:date>2022-01-17T17:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Panorama rest-api edit security policy post rule - 400 Unexpected here</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459179#M101974</link>
      <description>&lt;P&gt;You may also test using Ansible as it is generally more tested in my view:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.ansible.com/integrations/networks/palo-alto" target="_blank"&gt;Palo Alto Networks and Ansible&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://live.paloaltonetworks.com/t5/automation-api-discussions/updating-a-portion-of-the-rule-ansible/td-p/318575" target="_blank"&gt;Solved: LIVEcommunity - updating a portion of the rule - ansible - LIVEcommunity - 318575 (paloaltonetworks.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2022 08:06:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/panorama-rest-api-edit-security-policy-post-rule-400-unexpected/m-p/459179#M101974</guid>
      <dc:creator>nikoolayy1</dc:creator>
      <dc:date>2022-01-18T08:06:39Z</dc:date>
    </item>
  </channel>
</rss>

