Define the POST /orders responses

Map responses from your z/OS® Asset.

Before you begin

The following tasks must be completed:
  1. Prepare the sample CICS application.
  2. Starting the z/OS Connect Designer with Docker Desktop and importing an OpenAPI definition.
  3. Configure IPIC connections to CICS with Docker Desktop and Basic Authentication.
  4. Define the GET operation for the /items path.
  5. Reuse the catalogProgram z/OS Asset.
  6. Map the API Request to the z/OS Asset.

About this task

This topic is applicable to: z/OS Connect Designer
capability Content applicable to
application developers

Define the conditions for the OpenAPI responses 200, 400®, and 500 responses that are returned by the z/OS Asset.

Procedure

  1. Open the POST /orders Operation flow diagram as described Mapping your API and z/OS Assets.
    Figure 1. POST /orders responses.
    POST /orders responses.
  2. Click Responses on the Operation flow diagram.
    The Responses configuration panel opens. Responses are evaluated first to last where the final response is the default response. Each response has the following properties:
    • A condition with three fields, response, predicate, and value.
    • One or more conditions.
    • You can change the order of the responses by using the An arrow pointing up icon and An arrow pointing down icon buttons beside each response case.
    • The sequence of the conditions within a response can be changed. Click A drag vertical icon to change the position in the sequence.
    • Conditions can be deleted. Click A trash can icon to delete a condition.
    Figure 2. Responses available.
    Responses available.
  3. The default order of the responses is such that 200 - OK is the first to be evaluated and 500 - Internal server error is the last and therefore the default response.
    Note: Best practice is to configure 500 - Internal server error as the default response to capture any errors in the conditional logic of the response.

  4. Set conditions for the 200 - OK response.
    In this example, the 200 - OK indicates success.
    Select All the following are true and set the following conditions:
    Response field Predicate Value
    $zosAssetResponse.commarea.DFH0XCP1."CA-RETURN-CODE"
    Equals 0
    Tip: You can start typing "CA-RETURN-CODE" in the Response field to find the value.

    Figure 3. Defining the 200 OK response condition.
    Defining the 200 OK response condition.
  5. Set the condition for the 400 - Bad Request response.

    In this example, the 400 - Bad Request indicates that there is no stock to order of the item you have requested.

    Select All the following are true and set the following conditions:
    Response field Predicate Value
    $zosAssetResponse.commarea.DFH0XCP1."CA-RETURN-CODE"
    Equals 97
    Figure 4. Setting the condition for the 400 response.
    Setting the condition for the 400 response.
  6. The 500 - Internal server error response is the default, so it has no conditions and must be the last entry in the table.
    Figure 5. Default 500 response.
    Default 500 response.

Results

You have successfully defined the conditions in which the OpenAPI's responses (200, 400 and 500) are sent depending on what is returned by the z/OS Asset.

What to do next

Map the API Response fields.