09-26-2018 08:32 AM - edited 03-01-2019 04:13 AM
Hi team,
I am trying to get the output of "show running" command using live-stats via the REST API, i follow somebody's guide,
url as below:
curl -v -X POST -T show_running.xml -u admin:admin localhost:8080/api/operational/devices/device/SR-CISCO9K/live-status/cisco-ios-xr-stats:exec/_operations/show
payload as below
<show>
<args>running</args>
</show>
but i get some error message, any ideas on how to build the correct url to query this?
<errors xmlns="http://tail-f.com/ns/tailf-rest-error">
<error>
<error-tag>malformed-message</error-tag>
<error-urlpath>/api/operational/devices/device/SR-CISCO9K/live-status/cisco-ios-xr-stats:exec/show</error-urlpath>
<error-message>Unexpected content: '
'</error-message>
</error>
</errors>
Solved! Go to Solution.
09-28-2018 09:23 AM
Jan, really thank you for your message , it's very important for me, thanks.
09-27-2018 05:01 AM
I'm not entirely sure where you are headed with this, but if you really want to ask the device to show running config and get a string back for you to parse on your own, you should probably use the resource
localhost:8080/api/operational/devices/device/SR-CISCO9K/live-status/cisco-ios-xr-stats:exec/_operations/any
with payload
<any>
<args>show</args>
<args>running</args>
</any>
Also, you are using the old REST API. I would recommend that you to switch to standard RESTCONF instead.
09-27-2018 07:45 PM
Hi Jan ,thank you for your quickly answer, i got this info from below link
My customer have some app in development, Our arch team suggest customer to use REST API, Are you sure we will use RESTCONF to replace the REST api? , if so, I need give some message to customer.
also, i have got the config using your way ,it's correct, but i found 
 at the tail of every line, can i eliminate them?
logging events level informational
logging monitor informational
09-27-2018 11:30 PM
As far as I am aware, the REST interface is not going away soon, but the development of it has stopped. Why use a proprietary, old and not developing interface when there is a newer, standard and living interface also based on REST, i.e. RESTCONF?
The string you get back from this action is the raw response from the device. It contains those line breaks, which you are of course free to remove. This whole approach, to use NSO to access the raw text output of the device that you have to massage and parse yourself, might seem a little odd and brittle.
09-28-2018 09:23 AM
Jan, really thank you for your message , it's very important for me, thanks.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide