XML User API (using wget)~

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

XML User API (using wget)~

L3 Networker


Hi everyone

customer requested me for User XML

The device is 5.0.4 and There is no need to middleway server

PAN 5.0.x can receive restAPI directly

I do not make program properly

so I thought that I utilzed wget software

My labtop enviroment is Windows 7

There is simple wget.exe[win] in internet site

https://172.16.0.1/api/?type=keygen&user=admin&password=admin

I received unique key in advance

wget --no-check-certificate "https://192.168.1.180/api/?type=user-id&action=set&key=LUFRPT0vc2VVYTA5VHZKaDZkUnBkTytVb2tUSGdBKzA9N... name="zero-200" ip="172.16.0.200" timeout="20"></entry></login></payload></uid-message>" --output-document=pan-cfg.xml

response message saved pan-cfg.xml

I check message;;

open xml file

이미지 2.png

이미지 1.png

I don't understand that mean

because,,

When I inserted url box in web-browsing

https://192.168.1.180/api/?type=user-id&action=set&key=LUFRPT0vc2VVYTA5VHZKaDZkUnBkTytVb2tUSGdBKzA9N... name="zero-200" ip="172.16.0.200" timeout="20"></entry></login></payload></uid-message>

success!! no error

이미지 4.png

이미지 3.png

syntax do not support in wget?

[/, <, " etc..] ---> reason?

Why is this?

How can i solve this problem?

lately I tested utilzed wget software that made download running-config.xml

no error!

1 accepted solution

Accepted Solutions

L0 Member

Hi,

The problem is you have the URL wrapped in double quotes, but you also have double quotes within the URL, so wget sees the first double quote (just before zero-200) as the end of your message.  This is why the error from the Palo box is saying the end tags for payload and uid-message are not found.

To fix this you should just need to change each double quote in your URL for %22 (the encoded version) and it should work, e.g. (key shortened for ease of reading and changes in bold):

https://192.168.1.180/api/?type=user-id&action=set&key=LUFRPT0v09&vsys=vsys1&cmd=<uid-message><version>1.0</version><type>update</type><payload><login><entry name=%22zero-200%22 ip=%22172.16.0.200%22 timeout=%2220%22></entry></login></payload></uid-message>" --output-document=pan-cfg.xml

Really all of the spaces and angle brackets could do with encoding too, but it doesn't seem to be complaining about them, if you want to space is %20, < is %3c and > is %3e

Duncan

View solution in original post

1 REPLY 1

L0 Member

Hi,

The problem is you have the URL wrapped in double quotes, but you also have double quotes within the URL, so wget sees the first double quote (just before zero-200) as the end of your message.  This is why the error from the Palo box is saying the end tags for payload and uid-message are not found.

To fix this you should just need to change each double quote in your URL for %22 (the encoded version) and it should work, e.g. (key shortened for ease of reading and changes in bold):

https://192.168.1.180/api/?type=user-id&action=set&key=LUFRPT0v09&vsys=vsys1&cmd=<uid-message><version>1.0</version><type>update</type><payload><login><entry name=%22zero-200%22 ip=%22172.16.0.200%22 timeout=%2220%22></entry></login></payload></uid-message>" --output-document=pan-cfg.xml

Really all of the spaces and angle brackets could do with encoding too, but it doesn't seem to be complaining about them, if you want to space is %20, < is %3c and > is %3e

Duncan

  • 1 accepted solution
  • 2915 Views
  • 1 replies
  • 0 Likes
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!