Using the REST interface for XML API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using the REST interface for XML API

Not applicable

Howdy,

I have been using the REST interface for pulling reporting and config data using constructed URLs in scripts.  All that works well.  What I have been unable to do is use the set action for config.  I am using a key generated for a sysadmin user, but consistently get an "Unauthorized request" message:

<response status="unauth" code="16">

<msg>
<line>Unauthorized request</line>

</msg>

</response>

I am using the syntax from the Using the XML API document to send the request:

https://server/esp/restapi.esp?type=config&action=set&key=oursecretkey&xpath=devices/entry/vsys/entr...[@name='test']&element=<fqdn>test.domain.edu</fqdn>

Is this incorrect?  Is there more documentation somewhere that can give more detail on how these API URLs should be constructed?

I am using PANOS 4.0.4

Thank you,

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions

L1 Bithead

Hi,

Try to update your request with the following parameters:

  • action=edit
  • xpath=/config/devices/entry/vsys/entry/address/entry[@name='test']

Regards,

Adrien

View solution in original post

8 REPLIES 8

Not applicable

I can give details of what I actually am trying to do:

1. Custom report that tells me top source IPs of blocked traffic

2. Use API to retrieve list

3. Based on list, create an address object for each source IP

4. Add each address object to an address group that is denied access

The the deny rule and the address group is already setup, I just need a way for my scripts to manage the addresses in the address group.

Hi,

This is a great example and I will use it for documenting some API examples next week for a primer I am drafting on working with the XML API.  Thank You for the details.

Marc

That's great!  I am looking forward to seeing that primer.  That is one of our workflows that we hope to setup, but there are others that I would like to implement once I can fully utilize the API.

L1 Bithead

Hi,

Try to update your request with the following parameters:

  • action=edit
  • xpath=/config/devices/entry/vsys/entry/address/entry[@name='test']

Regards,

Adrien

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!