<?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 API auth REST vs SOAP in Next-Generation Firewall Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/next-generation-firewall/api-auth-rest-vs-soap/m-p/1224294#M5729</link>
    <description>&lt;P&gt;I'm having an issue authenticating via RESTful API, PAN OS version 11.1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SOAP to fetch my API key, then storing it here&lt;/P&gt;
&lt;P&gt;$header = @{&lt;BR /&gt;"X-PAN-KEY" = $apikey&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then Invoke-Restmethod like this&lt;/P&gt;
&lt;P&gt;Invoke-RestMethod -Uri $newURI -Method get -ContentType "application/json" -Headers $header&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;URI is &lt;A href="https://ip_address/restapi/v11.1/Device/VirtualSystems" target="_blank"&gt;https://ip_address/restapi/v11.1/Device/VirtualSystems&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;error message&lt;/P&gt;
&lt;P&gt;Invoke-RestMethod : {"code":7,"message":"Unauthorized","details":[{"@type":"CauseInfo","causes":[{"code":5,"module":"panui_auth","description":"Unauthorized"}]}]}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have any trouble pulling that data when I use SOAP like this&lt;/P&gt;
&lt;P&gt;/api?key=$apikey&amp;amp;type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;devices&amp;gt;&amp;lt;connected&amp;gt;&amp;lt;/connected&amp;gt;&amp;lt;/devices&amp;gt;&amp;lt;/show&amp;gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Mar 2025 12:23:03 GMT</pubDate>
    <dc:creator>BBagent</dc:creator>
    <dc:date>2025-03-20T12:23:03Z</dc:date>
    <item>
      <title>API auth REST vs SOAP</title>
      <link>https://live.paloaltonetworks.com/t5/next-generation-firewall/api-auth-rest-vs-soap/m-p/1224294#M5729</link>
      <description>&lt;P&gt;I'm having an issue authenticating via RESTful API, PAN OS version 11.1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SOAP to fetch my API key, then storing it here&lt;/P&gt;
&lt;P&gt;$header = @{&lt;BR /&gt;"X-PAN-KEY" = $apikey&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then Invoke-Restmethod like this&lt;/P&gt;
&lt;P&gt;Invoke-RestMethod -Uri $newURI -Method get -ContentType "application/json" -Headers $header&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;URI is &lt;A href="https://ip_address/restapi/v11.1/Device/VirtualSystems" target="_blank"&gt;https://ip_address/restapi/v11.1/Device/VirtualSystems&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;error message&lt;/P&gt;
&lt;P&gt;Invoke-RestMethod : {"code":7,"message":"Unauthorized","details":[{"@type":"CauseInfo","causes":[{"code":5,"module":"panui_auth","description":"Unauthorized"}]}]}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have any trouble pulling that data when I use SOAP like this&lt;/P&gt;
&lt;P&gt;/api?key=$apikey&amp;amp;type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;devices&amp;gt;&amp;lt;connected&amp;gt;&amp;lt;/connected&amp;gt;&amp;lt;/devices&amp;gt;&amp;lt;/show&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 12:23:03 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/next-generation-firewall/api-auth-rest-vs-soap/m-p/1224294#M5729</guid>
      <dc:creator>BBagent</dc:creator>
      <dc:date>2025-03-20T12:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: API auth REST vs SOAP</title>
      <link>https://live.paloaltonetworks.com/t5/next-generation-firewall/api-auth-rest-vs-soap/m-p/1225394#M5755</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/94115817"&gt;@BBagent&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on the error message, is the account you are using has the rights on the REST API (for custom role)?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.paloaltonetworks.com/pan-os/11-1/pan-os-panorama-api/get-started-with-the-pan-os-rest-api/pan-os-rest-api-error-codes" target="_blank"&gt;https://docs.paloaltonetworks.com/pan-os/11-1/pan-os-panorama-api/get-started-with-the-pan-os-rest-api/pan-os-rest-api-error-codes&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(you can try to set a new custom role with all the REST API set to allowed, then assigned to the account you are using for the API calls and check)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Olivier&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 04:48:41 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/next-generation-firewall/api-auth-rest-vs-soap/m-p/1225394#M5755</guid>
      <dc:creator>ozheng</dc:creator>
      <dc:date>2025-04-02T04:48:41Z</dc:date>
    </item>
  </channel>
</rss>

