<?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 Edit a security post-rule REST-API logic in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/514712#M3149</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/175399"&gt;@abedJawhar&lt;/a&gt;, yes, this is expected behaviour for a PUT in a RESTful API, where PUT methods normally expect the entire definition of a resource, because it replaces the resource definition. This is useful to maintain idempotent operations amongst other reasons. The PAN-OS REST API works in the same way with the PUT-based methods. It would be best to, in your code, do a GET first, modify the resource, then do a PUT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A feature request for future would be a PATCH-based HTTP method for the PAN-OS REST API to be able to provide partial resource definitions.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2022 12:01:05 GMT</pubDate>
    <dc:creator>JimmyHolland</dc:creator>
    <dc:date>2022-09-13T12:01:05Z</dc:date>
    <item>
      <title>Panorama Edit a security post-rule REST-API logic</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/503817#M3047</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if I'm using the edit security post-rule endpoint correctly or I'm missing something here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sending an HTTP PUT request to the panorama to update an existing security rule, but according to the documentation, if I want to update a single field (say the Source Address list), I need to send in the payload all the other fields that are already configured on the rule, even though I'm not changing them.&amp;nbsp; I tried sending the PUT request with just the source field, bit I got a response that I'm missing required fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this the normal behaviour of the edit endpoint? It's treating it the same way as the Add endpoint (POST Create a Security Post Rule). Any way I can use that endpoint by just sending the field I need to update and not every single field configured on the rule that I'm not editing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of the PUT request sent that failed cause of missing fields:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;requests.put(url="https://{{host}}/restapi/v9.1/Policies/SecurityPostRules?location=device-group&amp;amp;device-group={{dg_name}}&amp;amp;name={{rule_name}}", headers={"X-PAN-KEY": "{{key}}"}, data={"entry": {\"@name\": "{{rule_name}}", "source": {"member": ["NEW_ADDR_GRP"]}}}, verify=False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And we get this response:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"code":3,"message":"Invalid Object","details":[{"@type":"CauseInfo","causes":[{"code":12,"module":"panui_mgmt","description":"Invalid Object:  {{rule_name}}  is missing 'from'."}]}])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;When I add "from" to the pauload I get i'm missing "to", and this goes on until I have all the required fields from the Create endpoint in the payload, but it overwrites the optional fields that I did not include in my Edit payload.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;LI-PRODUCT title="Panorama" id="Panorama"&gt;&lt;/LI-PRODUCT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 13:51:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/503817#M3047</guid>
      <dc:creator>abedJawhar</dc:creator>
      <dc:date>2022-06-15T13:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Panorama Edit a security post-rule REST-API logic</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/514712#M3149</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/175399"&gt;@abedJawhar&lt;/a&gt;, yes, this is expected behaviour for a PUT in a RESTful API, where PUT methods normally expect the entire definition of a resource, because it replaces the resource definition. This is useful to maintain idempotent operations amongst other reasons. The PAN-OS REST API works in the same way with the PUT-based methods. It would be best to, in your code, do a GET first, modify the resource, then do a PUT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A feature request for future would be a PATCH-based HTTP method for the PAN-OS REST API to be able to provide partial resource definitions.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:01:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/514712#M3149</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2022-09-13T12:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Panorama Edit a security post-rule REST-API logic</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/514714#M3150</link>
      <description>&lt;P&gt;Thanks for the info&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:13:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/panorama-edit-a-security-post-rule-rest-api-logic/m-p/514714#M3150</guid>
      <dc:creator>abedJawhar</dc:creator>
      <dc:date>2022-09-13T12:13:54Z</dc:date>
    </item>
  </channel>
</rss>

