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

If the placeOrder.sar file was generated on a different machine, transfer the file, in binary mode, to the workstation where IBM® Explorer for z/OS® is installed.

About this task

The operation is implemented as an HTTP POST request and demonstrates exposing a resource with assign, move and remove transforms to map to the placeOrder service.

Procedure

  1. Select the catalog API tab and click + sign next to Path to add a new Path. Enter /orders in the imput field and delete the GET, PUT and DELETE methods.
  2. 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.
  3. Click File System and navigate to the location of the placeOrder.sar file. Select the file and click Open.
    The Import Services dialog opens.
  4. Click OK.
    The placeOrder service now appears in the Service dialog. Click OK. This operation now maps to the placeOrder service.
    Screen image of API Editor shows path set to /orders and placeOrder service assigned to the POST method.
  5. From the menu bar, select File > Save.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. In the request mapping, expand ca_order_request. Add an Assign transform to ca_userid and ca_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.
  11. For both ca_return_code and ca_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.
    Screen image showing request mapping.
  12. In the response mapping, for each of ca_request_id and ca_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.
    Screen image showing response mapping.
  13. Save the request and response mapping files.