The following are Examples of POST, DELETE, PUT, GET, PATCH, and Operations.

POST 

curl -i -X POST -k -u username:userpassword -s https://10.54.153.148/api/config -H "Content-type:e application/vnd.yang.datastore xml" --data '<addressContext><name>ADDR_CONT_1</name></addressContext>' 

DELETE

curl -i -X DELETE -u username:userpassword http://10.54.153.148/api/config/addressContext/ADDRESS_CONTEXT_1

PUT

curl -i -X PUT -u  username:userpassword -s http://localhost:8008/api/config/addressContext/ADDRESS_CONTEXT_1  -H "Content-type: application/vnd.yang.data xml" --data '  <addressContext>    <name>ADDRESS_CONTEXT_1</name>  <ipInterfaceGroup>  <name>LIG1</name>  <ipInterface>  <name>LIF1_v4</name>      <ceName>PEAR</ceName>  <portName>pkt0</portName>  <ipAddress>10.54.154.95</ipAddress>  <prefix>24</prefix>  <mode>inService</mode>   <state>enabled</state>  </ipInterface>  </ipInterfaceGroup>   </addressContext> '

GET

curl -iksu username:userpassword-s https://10.54.170.57/api/config/addressContext/

HTTP/1.1 200 OK
Date: Wed, 30 Apr 2014 08:45:30 GMT
Server: ConfD/5.0.3.2
Cache-control: private, no-cache, must-revalidate, proxy-revalidate
Content-Type: application/vnd.yang.data xml
Via: 1.1 169.254.99.1
Transfer-Encoding: chunked
 
<collection xmlns:y="http://tail-f.com/ns/rest">
  <addressContext xmlns="http://sonusnet.com/ns/mibs/SONUS-ADDRESS-CONTEXT/1.0" y:self="/api/config/addressContext/default">
    <name>default</name>
    <zone xmlns="http://sonusnet.com/ns/mibs/SONUS-ZONE/1.0" y:self="/api/config/addressContext/default/ZONE:zone/defaultSigZone">
      <name>defaultSigZone</name>
    </zone>
  </addressContext>
</collection>

 PATCH

curl -u  username:userpassword -i -s -X PATCH  https://10.54.153.148/api/candidate/system/security/pki/certificate/defaultSBCCert -H "Content-type: application/vnd.yang.data xml" --data '<certificate><fileName>newName</fileName></certificate>' 

 Operations

To create a RESTART server, using the POST operation : 

request system serverAdmin papaya restart
curl -u username:userpassword-X POST  -i -s http://localhost:8008/api/running/system/serverAdmin/papaya/_operations/restart -H "Content-type: application/vnd.yang.data xml" --data '<restart></restart>'

 

 

  • No labels