- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
03-20-2025 05:23 AM
I'm having an issue authenticating via RESTful API, PAN OS version 11.1
Using SOAP to fetch my API key, then storing it here
$header = @{
"X-PAN-KEY" = $apikey
}
Then Invoke-Restmethod like this
Invoke-RestMethod -Uri $newURI -Method get -ContentType "application/json" -Headers $header
URI is https://ip_address/restapi/v11.1/Device/VirtualSystems
error message
Invoke-RestMethod : {"code":7,"message":"Unauthorized","details":[{"@type":"CauseInfo","causes":[{"code":5,"module":"panui_auth","description":"Unauthorized"}]}]}
I don't have any trouble pulling that data when I use SOAP like this
/api?key=$apikey&type=op&cmd=<show><devices><connected></connected></devices></show>
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!