Or
curl -k --header "Content-type:application/xml" -d @"input.xml"
"https://192.168.0.1/ws/v2/service_cfg/input?session=$token"
Post
POST is used when a request body (in XML, JSON, or other formats) is present and is transferred to the unit
with the request. The following lists three ways to use cURL to post parameters and arguments.
1
Using only arguments on command line separated by "&" (Maximum of 26 arguments, excluding JSON
argument and session argument):
curl -k -i -H "X-SESSION-ID: $token" -X POST
"https://192.168.0.1/ws/v2/service_cfg/input/rf?port=[port#]&dnlkfreq=<Freq>"
curl -k -i -H "X-SESSION-ID: $token" -X POST
"https://192.168.0.1/ws/v2/service_cfg/input/rf?port=2&dnlkfreq=12.31"
Or:
curl -k -X POST
"https://192.168.0.1/ws/v2/service_cfg/input/rf?port=[port#]&DnlkFreq=<Freq>&session=$token"
<?xml version="1.0" encoding="ISO-8859-1"
?><response><code>10</code><result>success</result><message></message></response>
The resource URI needs to be quoted 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 %20 instead
of a space.
2
Using xml data from command line:
curl -k -i -H "X-SESSION-ID: $token" -X POST --header "Content-type:application/xml" -d
"<Input><RF><Port>1</Port><Act>Yes</Act></RF</Input>"
https://192.168.0.1/ws/v2/service_cfg/input?session=$token
Or
curl -k -i -X POST --header "Content-type:application/xml" -d
"<Input><RF><Port>1</Port><Act>Yes</Act></RF</Input>"
https://192.168.0.1/ws/v2/service_cfg/input?session=$token
3
Using xml data from file:
curl -k -i -H "X-SESSION-ID: $token" -X POST --header "Content-type:application/xml" -d
@"input.xml" https://192.168.0.1/ws/v2/service_cfg/input
Or
curl -k -i -X POST --header "Content-type:application/xml" -d @"input.xml"
"https://192.168.0.1/ws/v2/service_cfg/input?session=$token"
A maximum of 26 arguments (after the ?, and not including the session and json arguments) can be set in a
single POST operation from a Web Services API cURL command line request. If a POST request is made
that specifies more than the maximum, the response behavior is undefined (typically, the extra request
parameters are ignored). We highly recommend that you use the alternate write from file method to set multiple
arguments at the same time.
HTTP Responses
This section describes the HTTP status codes and content response types.
Cisco D9800 Network Transport Receiver Version 2.75 RESTful Web Services API Reference Guide
4
Web Services API
Post