Http Request Methods - Cisco D9800 Reference Manual

Network transport receiver
Hide thumbs Also See for D9800:
Table of Contents

Advertisement

Web Services API
The value of the $token variable needs to be set based on the TokenValue from the XML response to the
Login Command. This may be done by using the Linux (or Cyqwin) export command.
The example below assumes TokenValue = 869a010f-16e9-4b5a-b302-0097c779850f.
...<SESSION_ID>869a010f-16e9-4b5a-b302-0097c779850f </SESSION_ID>...
Usage Example (setting $token environment variable):
export token=869a010f-16e9-4b5a-b302-0097c779850f
An alternative to setting the environment variable is to replace $token with the literal string from the above
(XML) output when calling the additional command(s). The following is an example of a logout command.
Input:
curl -k https://192.168.0.1/ws/v1/table?t=return -X POST -d "<HDR><LOGOUT><ITEM><REASON>User
Logout</REASON></ITEM></LOGOUT></HDR>" -H "Content-Type: text/xml; charset=UTF-8" -H
"X-SESSION-ID: $token"
Expected output:
?xml version="1.0" encoding="ISO-8859-1"?>
<HDR><TABLE><ITEM><ID>STATUS</ID><VALUE>Please wait while the default page loads up
. . . . < / V A L U E > < / I T E M > < L O G I N _ I N F O > < U S E R _ N A M E > < / U S E R _ N A M E > < U S E R _ R O L E > N o t V a l i d < / U S E R _ R O L E > < S E S S I O N _ I D > N O N E < / S E S S I O N _ I D > < / L O G I N _ I N F O > < / T A B L E > < / H D R >

HTTP Request Methods

HTTP methods are defined by RFC 1945. We currently support GET and POST methods.
Get
GET is used for URI requests that have no payload to transfer in their bodies. GET can be formatted in either
XML or JSON.
The following is an example of a Request in XML:
curl -k -i -H "X-SESSION-ID: $token" "https://192.168.0.1/ws/v2/service_cfg/input/rf?port=2"
Or:
curl -k "https://192.168.0.1/ws/v2/service_cfg/input/rf?port=2&session=$token"
The following is an example of a Request in JSON (by specifying js=1):
curl -k -i -H "X-SESSION-ID: $token"
"https://192.168.0.1/ws/v2/service_cfg/input/rf?port=1&js=1"
Or:
curl -k
The resource URI must be in quotes if you pass in multiple query parameters separated by '&'. If you have
spaces in the query values, you should encode them. For example, use the + symbol, or the %20 symbol,
instead of a space (http://blogs.plexibus.com/2009/01/15/rest-esting-with-curl/).
A maximum of 26 arguments (after the ? symbol, and not including the session and json arguments) can be
queried in a single GET operation from a Web Services API cURL command line request. If a GET request
is made that specifies more than this amount, the response behavior is undefined (typically, the extra request
parameters will be ignored). We strongly recommend that you use the alternate block read method to retrieve
many arguments at once.
The following is an example of a Block Data GET request.
Passing a block of XML data from a file:
curl -k -i -H "X-SESSION-ID: $token" --header "Content-type:application/xml" -d @"input.xml"
"https://192.168.0.1/ws/v2/service_cfg/input"
"https://192.168.0.1/ws/v2/service_cfg/input/rf?port=1&js=1&session=$token"
Cisco D9800 Network Transport Receiver Version 2.75 RESTful Web Services API Reference Guide
HTTP Request Methods
3

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents