Create an operation to place an order for an item
The following steps create an operation to place an order for an item in the catalog.
Before you begin
About this task
placeOrder
service.Procedure
- Select the catalog API tab and click next to Path to add a new Path. Enter /orders in the imput field and delete the GET, PUT and DELETE methods.
-
Click Service... for the POST method to select the service archive file that
defines the service on this API path that will be called by an HTTP POST request.
The Select a z/OS Connect Service dialog opens.
-
Click File System and navigate to the location of the
placeOrder.sar file. Select the file and click
Open.
The Import Services dialog opens.
-
Click OK. The placeOrder service now appears in the Service dialog. Click OK. This operation now maps to the placeOrder service.
- From the menu bar, select .
-
Click Mapping... for the POST method and 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
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 01ORDR.
This is the value required by the CICS® Catalog Manager application to order items from the catalog.
-
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_order_request
. Add an Assign transform toca_userid
andca_charge_dept
.Both these JSON properties will use the default value of an empty string, so no value needs to be specified in the Properties tab. -
For both
ca_return_code
andca_response_message
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. -
In the response mapping, for each of
ca_request_id
andca_order_request
, 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.