<?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: Call API key via invoke-restmethod in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185372#M56728</link>
    <description>&lt;P&gt;I finally figured it out...simple (usually is).&lt;/P&gt;&lt;P&gt;Set a variable in your script that looks for your apikey elsewhere, like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$apikey = Get-Content "&amp;lt;path_to_file&amp;gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then, simply make your "key" a variable in the HTTPS request.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;https://hostname/api/?type=config$action=get&amp;amp;xpath=/config&amp;amp;&lt;STRONG&gt;key=$apikey&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm now having other problems with the x-path...back to the drawing board.&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>Fri, 03 Nov 2017 15:22:07 GMT</pubDate>
    <dc:creator>turturici</dc:creator>
    <dc:date>2017-11-03T15:22:07Z</dc:date>
    <item>
      <title>Call API key via invoke-restmethod</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185217#M56690</link>
      <description>&lt;P&gt;Is Palo Alto's API able to accept GET requests from the PowerShell "invoke-restmethod" cmdlet which have the api key set as a variable?&amp;nbsp; I ask this because I would like to run these requests without embedding my API key in the HTTPS GET request.&amp;nbsp; This does not seem secure to me.&amp;nbsp; Rather, I would like to store the API key elsewhere and have PowerShell call that file to insert the key in to the string, or elsewhere in the request, like in the Authorization header.&amp;nbsp; I've been toying around with this to no avail.&amp;nbsp; I'm wondering if the API can handle this type of request?&amp;nbsp; Has anyone come up against this and prevailed?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 18:08:12 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185217#M56690</guid>
      <dc:creator>turturici</dc:creator>
      <dc:date>2017-11-02T18:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Call API key via invoke-restmethod</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185227#M56693</link>
      <description>&lt;P&gt;I haven't used it yet, but came across a pan-python module on the api-lab site that uses a .panrc file on the local host to reference a Palo Alto firewall IP and the associated API key.&amp;nbsp; That file is referenced during api calls to pass in the key without specifying it on the command line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obviously not Powershell, but may be adaptable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://api-lab.paloaltonetworks.com/module-1.html" target="_blank"&gt;http://api-lab.paloaltonetworks.com/module-1.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;chrislss&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 19:05:19 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185227#M56693</guid>
      <dc:creator>chrislss</dc:creator>
      <dc:date>2017-11-02T19:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Call API key via invoke-restmethod</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185372#M56728</link>
      <description>&lt;P&gt;I finally figured it out...simple (usually is).&lt;/P&gt;&lt;P&gt;Set a variable in your script that looks for your apikey elsewhere, like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$apikey = Get-Content "&amp;lt;path_to_file&amp;gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then, simply make your "key" a variable in the HTTPS request.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;https://hostname/api/?type=config$action=get&amp;amp;xpath=/config&amp;amp;&lt;STRONG&gt;key=$apikey&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm now having other problems with the x-path...back to the drawing board.&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>Fri, 03 Nov 2017 15:22:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/call-api-key-via-invoke-restmethod/m-p/185372#M56728</guid>
      <dc:creator>turturici</dc:creator>
      <dc:date>2017-11-03T15:22:07Z</dc:date>
    </item>
  </channel>
</rss>

