Modify adress group by xml api with POST method

Reply
L1 Bithead

Modify adress group by xml api with POST method

Hello

 

I'm trying to modify a shared address group bye using xml api and use POST http method

 

url:

https://$url/api/?key=$key&type=config&action=edit&xpath=/config/shared/address-group/entry[@name='GRP-NAME']

header:

Content-Type='text/xml'

body:

<entry name="GRP-NAME">
    <static>
        <member>SRV-10.0.0.32</member>
     <member>172.20.34.101</member>
    </static>
</entry>

 

But when i execute post call with POSTMAN, The response is:

<response status="error" code="12">
    <msg>
        <line>Invalid target object in edit handler</line>
    </msg>
</response>

 

I don't understand why, because if i do:

https://$url/api/?key=$key&type=config&action=get&xpath=/config/shared/address-group/entry[@name='GRP-NAME']

The response is the detail of the group 'GRP-NAME'

 

thanks

L1 Bithead

Re: Modify adress group by xml api with POST method

I found the solution:

 

put in url only:

https://$url/api/

 

headers:

 ['Content-Type' => 'application/x-www-form-urlencoded']

 

body:

key=$key&type=config&action=edit&xpath=/config/shared/address-group/entry[@name="GRP-NAME"]&element=<entry name="GRP-NAME"><static><member>namemembers</member</static></entry>'

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 Live Community as a whole!

The Live Community thanks you for your participation!