- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
03-07-2021 11:33 PM
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
03-08-2021 06:59 PM
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>
03-08-2021 06:59 PM
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>
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!