All Create, Read, Update, and Delete (CRUD) operations are supported and performed by using the standard HTTP methods: GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.
The GET method is used to retrieve the representation of the resource (for example, operational-state) including the metadata information.
For example, the following GET method with the Resource-Depth header and its value of 6 requests the client to retrieve the operational state of CFM connectivity.
GET /rest/operational-state/cfm-state/cfm-connectivity/domain/test/ma/name//ma-type HTTP/1.1 Authorization: Basic YWRtaW46cGFzc3dvcmQ= User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 Host: 10.1.1.1 Accept: application/vnd.operational-state.resource+xml Resource-Depth: 6
The following response contains XML representation of the target resource.
<ma xmlns="urn:brocade.com:mgmt:brocade-dot1ag-operational" xmlns:y="http://brocade.com/ns/rest" y:self="/rest/operational-state/cfm-state/cfm-connectivity/domain/test/ma/name"> <ma-name>name</ma-name> <ma-idx>1</ma-idx> <ma-type>0</ma-type> <ccm-interval>1000</ccm-interval> <vlan-id>120</vlan-id> <priority>1</priority> <mep y:self="/rest/operational-state/cfm-state/cfm-connectivity/domain/test/ma/name/mep/1"> <mep-id>1</mep-id> <mep-direction>mep-status-up</mep-direction> <mep-mac>768e.f809.e813</mep-mac> <mep-port>"Eth 1/15"</mep-port> <port-state>0</port-state> <rmep y:self="/rest/operational-state/cfm-state/cfm-connectivity/domain/test/ma/name/mep/1/rmep/2"> <rmep-id>2</rmep-id> <rmep-mac>0000.0000.0000</rmep-mac> <vlan-id>0</vlan-id> <rmep-port>""</rmep-port> <rmep-state>0</rmep-state> </rmep> </mep> </ma>
Note
A request payload is not required for a GET operation.The POST method is used to create a new resource in the specific resource location identified by the URI specified in the given request, and is used to identify YANG-RPC operation resources. The URI of the newly created resource is mentioned in the "Location" header of the response.
The following example shows the POST request to add a new LDAP server.
Request header
POST /rest/config/running/ldap-server HTTP/1.1 Authorization: Basic YWRtaW46cGFzc3dvcmQ= User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 Host: 192.168.10.2 Accept: application/vnd.configuration.resource+xml Content-Length: 51
Request message body
<host> <hostname>LDAP_TEST_HOST</hostname> </host>
On successful creation, the response contains an empty message body and the following headers with status.
Response
HTTP/1.1 201 Created Date: Tue, 24 Jun 2016 10:38:15 GMT Server: SLX-OS Wave WWW Location: http://192.168.10.2/rest/config/running/ldap-server/host/test_API Cache-control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html
Note
A request payload is required for a POST operation.The PUT method is used to update or replace an existing "Container" resource completely. If the URI does not identify the resource to be replaced, then the resource in the request URI is newly created, and the URI of the newly created resource is mentioned in the "Location" header of the response
This method creates the new resource, instead of replacing it, if the targeted resource is defined as a "List" statement in the YANG model.
The following example shows the PUT request to set the Active Directory parameters.
Request header
PUT /rest/config/running/ldap-server/host HTTP/1.1 Authorization: Basic YWRtaW46cGFzc3dvcmQ= User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 Host: 10.20.234.122 Accept: application/vnd.configuration.resource+xml Content-Length: 165
Request message body
<host> <port>500</port> <retries>50</retries> <timeout>60</timeout> <basedn>sample</basedn> </host>
On successful replace, the response contains an empty message body and the following headers with status.
Response
HTTP/1.1 204 No Content Date: Tue, 24 Jun 2016 11:03:55 GMT Server: SLX-OS Wave WWW Cache-control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html
Note
A request payload is required for a PUT operation.The PATCH method is used to edit or update the leaf attributes of the resource (List or Container), if the system supports the modification. For example, modifying the leaf or list child resource of the ACL sequence command is not possible, as it is not allowed in the system.
The following example shows the PATCH request to update the Active Directory parameter values.
Request header
PATCH /rest/config/running/ldap-server/host/test_API HTTP/1.1 Authorization: Basic YWRtaW46cGFzc3dvcmQ= User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 Host: 192.168.10.2 Accept: application/vnd.configuration.resource+xml Content-Length: 55
Request message body
<host> <basedn>sample_test</basedn> </host>
On successful update of an attribute, the response contains an empty message body and the following headers with status.
Response
HTTP/1.1 204 No Content Date: Tue, 24 Jun 2016 11:15:48 GMT Server: SLX-OS Wave WWW Cache-control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html
Note
A request payload is required for a PATCH operation.The DELETE method is used to delete the known resource.
The following example shows the DELETE request to delete an existing LDAP server.
Request header
DELETE /rest/config/running/ldap-server/host/test_API HTTP/1.1 User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 Host: 192.168.10.2 Accept: */* Authorization: Basic YWRtaW46cGFzc3dvcmQ=
On successful deletion of the resource, the response contains an empty message body and the following headers with status.
Response
HTTP/1.1 204 No Content Date: Tue, 24 Jun 2016 10:50:33 GMT Server: SLX-OS Wave WWW Cache-control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html
Note
An authorization header is required to perform a DELETE operation.Note
A request payload is not required for a DELETE operation.The HEAD method is used to retrieve the metadata information of the resource, identified by the given request. The response to this operation contains only the headers and an empty response body.
Request header
HEAD /rest/config/running/mac/access-list/standard/testacl1 HTTP/1.1 Authorization: Basic YWRtaW46cGFzc3dvcmQ= User-Agent: <REST client> Host: 192.168.10.2:80 Accept: application/vnd.configuration.resource+xml
On successful retrieval of the resource, the response contains an empty message body and the following headers with status.
Response
HTTP/1.1 200 OK Server: Wave World Wide Web Server (W4S) v0.0.1 Cache-control: private, no-cache, must-revalidate, proxy-revalidate Date: Tue, 03 Dec 2013 07:40:43 GMT Content-Type: application/vnd.configuration.resource+xml
Note
A request payload is not required for a HEAD operation.The OPTIONS method is used to retrieve the allowed methods on the resource identified by the given request. The response to this operation contains the headers and an empty response body. The "Allow" header contains the allowed operations on the resource.
Request header
OPTIONS /rest/config/running/mac/access-list/standard/testacl1 HTTP/1.1 Authorization: Basic YWRtaW46cGFzc3dvcmQ= User-Agent:<REST client> Host: 192.168.10.2:80 Accept: application/vnd.configuration.resource+xml
Response
HTTP/1.1 200 OK Server: Wave World Wide Web Server (W4S) v0.0.1 Cache-control: private, no-cache, must-revalidate, proxy-revalidate Date: Tue, 03 Dec 2013 07:40:55 GMT Content-Length: 0 Content-Type: text/html Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Note
A request payload is not required for an OPTIONS operation.