I send a request using "set" action but in the logs is an "edit" action and it replaces the configuration
cancel
Showing results for 
Search instead for 
Did you mean: 

I send a request using "set" action but in the logs is an "edit" action and it replaces the configuration

Hello,

I try to add new administrators using the XML API. I send a "set" action in order to add a new admin. However it replaces the configuration and just add the new admin.  I have tried POST and PUT methods. 
The call is:

https://XXXXXX/api?type=config&action=set&key=XXXX&xpath=/config/mgt-config/users&element= <users><entry name="XXXXXX"><permissions><role-based><superuser>yes</superuser></role-based></permissions><authentication-profile>XXXXX</authentication-profile></entry></users>


Any suggestions or comments? I have opened a case with Palo Alto support as well

1 ACCEPTED SOLUTION

Accepted Solutions

Cyber Elite
Cyber Elite

@NotisKontothanasis ,

That's because this is what you're telling the device to do. You're having it replace everything under <users> which is not what you want. You need to modify the request slightly so that the element you are modifying is the entry you are trying to create instead of the entirety of <users/>. 

https://MYFIREWALL/api?type=config&action=set&key=MYKEY&xpath=/config/mgt-config/users&element=<entry name="MYUSER"><permissions><role-based><superuser>yes</superuser></role-based></permissions><phash>MYPHASH</phash></entry>

 

View solution in original post

2 REPLIES 2

Cyber Elite
Cyber Elite

@NotisKontothanasis ,

That's because this is what you're telling the device to do. You're having it replace everything under <users> which is not what you want. You need to modify the request slightly so that the element you are modifying is the entry you are trying to create instead of the entirety of <users/>. 

https://MYFIREWALL/api?type=config&action=set&key=MYKEY&xpath=/config/mgt-config/users&element=<entry name="MYUSER"><permissions><role-based><superuser>yes</superuser></role-based></permissions><phash>MYPHASH</phash></entry>

 

View solution in original post

Thanks a lot! 

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!