How to use CorteX Conditional GET

 

CorteX ISE FW version post-1.6.2 allows web clients to take advantage of the HTTP Conditional GET process.  This includes an entity tag (ETag) returned in most GET Request response headers.  The ETag may be used to determine if certain resources have “changed state” since the last time the web client requested information regarding a particular resource or list of resources.

How it works

The web client will receive an ETag as part of the response header which can be used to pass the “If-Not-Modified” conditional to the web service to determine if the resource has changed between GET Requests.  An example:

Web Client Request:

GET /storage/volumes

Web Service Response:

HTTP/1.0 200 OK

Etag: "7acd9b16a47ed1297c4ff34d79fd8c9b"

Content-type: application/xml

 

<?xml version="1.0" encoding="ISO-8859-1"?><volumes self="http://........

The web client can capture the ETag returned in the response and use it in this manner for the next GET Request:

Web Client Request:

GET /storage/volumes

If-Not-Modified: "7acd9b16a47ed1297c4ff34d79fd8c9b"

 

Web Service Response:

HTTP/1.0 304 Not Modified

Etag: "7acd9b16a47ed1297c4ff34d79fd8c9b"

Content-length: 0

 

The web client will understand from the “304 Not Modified” response that the resource or list of resources has not changed since the last time it retrieved the information.  Using Conditional GET significantly reduces network traffic by eliminating unneeded transfer of data if it has not changed over time.  This works great with web clients that need to “poll” for status frequently.

 

How it Affects CorteX

Because of the reduction of network traffic using the Conditional GET process, the CorteX interface has removed the “returned=optional” capabilities on the participating resources such that all responses are fully verbose.  This means that GET responses are either fully verbose or fully silent if the web client uses the ETag with “If-Not-Modified” conditional request header. 

NOTE: The only exception to this is the “discoveredarray=yes” query at the main site page to get the list of discovered arrays from the storage device’s point-of-view.

How to use CorteX Conditional PUT

 

CorteX ISE FW version post-1.6.2 allows web clients to take advantage of the HTTP Conditional PUT process.  This includes an entity tag (ETag) returned in most GET Request response headers.  The ETag  may be used to determine if certain resources have “changed state” since the last time the web client requested information regarding a particular resource or list of resources.  When used with the HTTP PUT method, the web client can determine if the resource has changed since the last GET response before a PUT (modify) is executed.  This is called “optimistic concurrency”.  It is the opposite of implementing explicit locking mechanisms to handle multiple web clients (“pessimistic concurrency”).

How it works

The web client will receive an ETag as part of the GET response header which can be used to pass the “If-Match” conditional to the web service to determine if the resource has changed just before the PUT Request.  An example:

Web Client Request:

GET /storage/volumes

Web Service Response:

HTTP/1.0 200 OK

Etag: "7acd9b16a47ed1297c4ff34d79fd8c9b"

Content-type: application/xml

 

<?xml version="1.0" encoding="ISO-8859-1"?><volumes self="http://........

The web client can capture the ETag returned in the response and use it in this manner for the PUT Request to change the size of a particular volume:

Web Client Request:

PUT /storage/volume/{id}?size=44

If-Match: "7acd9b16a47ed1297c4ff34d79fd8c9b"

 

Web Service Response if there was no change previously:

HTTP/1.0 201 Created

Location: http://10.20.54.32/storage/volumes/{id}

Content-type: application/xml

 

<?xml version="1.0" encoding="ISO-8859-1"?><response value="2">A volume was modified.</response>

 

If the resource was changed by some other web client, the concurrency capability comes into play when using the ETag with “If-Match”.  An example where the ETag is no longer valid:

 

PUT /storage/volume/{id}?size=44

If-Match: "7acd9b16a47ed1297c4ff34d79fd8c9b"

 

Web Service Response if there was a change previously (ETag is old):

HTTP/1.0 412 Precondition Failed

Content-type: application/xml

 

<?xml version="1.0" encoding="ISO-8859-1"?><response value="412">Precondition Failed: Unexpected change occurred since last GET</response>