Create an operation to inquire about an item
The following steps create an operation to inquire about an item in the catalog.
Before you begin
About this task
inquireSingle
service.Procedure
- Rename the default Path value to be /items/{itemID} by typing over the existing value, where {itemID} indicates a path parameter whose value will be substituted at runtime.
-
Remove the POST, PUT and DELETE methods by clicking on the
at the end of the line. This should leave only the GET method allowed for the path /items/{itemID}.
-
Click Service... for the GET method to select the service archive file that
defines the service on this API path that will be called by an HTTP GET request.
The Select a z/OS Connect Service dialog opens.
-
Click File System and navigate to the location of the
inquireSingle.sar file. Select the file and click
Open.
The Import Services dialog opens. Click OK. The inquireSingle service now appears in the Service dialog.Click OK. This operation now maps to the inquireSingle service.
- From the menu bar, select .
-
Click Mapping... for the GET method, then click Open Both
Mappings.
The request and response mapping editors open so that you can define the mapping between the content of the API's HTTP request and response, and the JSON content passed to and from the z/OS Connect (OpenAPI 2) service.
-
In the request mapping, right click on
ca_request_id
and click Add Assign transform.This assigns a static value to the property in the request JSON payload passed to the service. -
Ensure Assign has focus, so that the Transform - Assign
dialog is displayed in the Properties view. On the General
tab, set Value to 01INQS.
This is the value required by the CICS® Catalog Manager application to perform an inquiry on a single catalog item.
-
Ensure Omit from interface is checked.
This excludes this property from the HTTP request body for this operation. This value must be set for the CICS Catalog Manager application, but because its value is the same for all requests, it does not need to be exposed to users of the API.
-
In the request mapping, expand
ca_inquire_single
. For each ofca_return_code
,ca_response_message
, andca_single_item
right click the property and click Add Remove transform.This excludes these properties from the HTTP request for this operation. These values are not required on the request. They will be populated by the Catalog Manager application and returned in the response. -
Connect the path parameter itemID to
ca_item_ref_req
by dragging from the path parameter itemID to the JSON property ca_item_ref_req.This creates a Move transform that copies the value from the path parameter in the HTTP request to the property in the JSON payload passed to the IBM z/OS Connect service. -
In the response mapping, for each of
ca_request_id
andca_item_ref_req
, right click the property and click Add Remove transform.This excludes these properties from the HTTP response body for this operation. These properties do not need to be exposed in the response to the API user. - Save the request and response mapping files.