Design considerations for RESTful web service provider applications
This topic describes some issues you should consider when planning and designing a RESTful web service provider application for JSON.
Collections of Resources
GET /Services/CustomerDetails?Surname=Cooper
This
request is expected to return information on all CustomerDetails objects
where the Surname is "Cooper". Individual CustomerDetails objects
may be returned using a more specific URI such as:
GET /Services/CustomerDetails/Customer27
In
this example
Customer27
is the primary key for a
specific customer. The output from this second query will be an instance
of the CustomerDetails object. The output from the first query is
less clear: it could return a list of CustomerDetails objects, or
it could return a list of URIs for CustomerDetails objects (which
the client can go on to retrieve individually). Both conventions are
common.
GET
/Services/CustomerDetails?startRecord=200&endRecord=225
You're
likely to need two URIMAP resources in CICS (and two WEBSERVICE
resources).
One that maps the root URI structure for the Collection, and a
wild-carded
URIMAP for the Instances. For example:
URIMAP1: Path=/Services/CustomerDetails
WEBSERVICE=CollectionService
URIMAP2: Path=/Services/CustomerDetails/* WEBSERVICE=InstanceService
Cache Management
The RESTful architecture encourages integration with standard HTTP cache management techniques. This allows the results of GET requests to be cached in the network, thereby reducing the burden on the server. The mechanism for doing this involves setting an expiration date/time for data returned for GET requests.
There is no general purpose mechanism to support application controlled cache expiration in CICS, but a Pipeline Handler program could be written to add the appropriate HTTP Header using the EXEC CICS WEB WRITE HTTPHEADER API. Application programs can do something similar, but only if they are hosted in the same CICS region that receives the HTTP request.