Test the GET /employees/{id} operation

Testing your API project GET /employees/{id} operation with z/OS® Connect Designer by using the Open Liberty REST Client.

Before you begin

The following tasks must be completed:
  1. Starting the z/OS Connect Designer with Docker and importing an OpenAPI definition.
  2. Configuring your connections to Db2.
  3. Create the getEmployee z/OS Asset.
  4. Map the API request to the z/OS Asset.
  5. Define GET /employees/{id} responses.
  6. Map the API response fields.

About this task

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

Learn how to test your newly configured GET/employees/{id} operation.

Procedure

  1. Open the Operation Viewer as described Mapping your API and z/OS Assets.
  2. In the z/OS Connect Designer window, click Test.
    Figure 1. Location of the test button.
    The test button is located in the upper right corner of the z/OS Connect Designer window.
    Table 1. Test API button status
    Indication Status
    Test API button enabled Enabled. Click the button to test your API.
    Test API button in unavailable state with loading indicator Button is unavailable with a loading indicator. The project build is running.
    Test API button in unavailable state with error indicator Button is unavailable with an error indicator. The project build failed. Hover over the button to see error information. For example, Test API button in unavailable state with error indicator and hover text with error message
  3. Test the GET /employees/{id} operation.
    1. Click anywhere on the GET /employees/{id} operation bar to expand the GET /employees/{id} operation.
      Figure 2. Information about the GET /employees/{id} operation to be tested.
      Information about the GET /employees/{id} operation to be tested.
    2. Click Try it out.
      Figure 3. The location of the Try it out button in the Liberty server Swagger Editor.
      The Try it out button is located in the upper right corner of the Liberty server Swagger Editor.
    3. In the Id field, enter 000150.
      Figure 4. Populating the Id parameter.
      Populating the Id parameter.
    4. Click Execute.
      Figure 5 shows the result of a successful test.
      Figure 5. Successful test result.
      Successful response from Db2 showing a list of employees as a JSON payload
    You can also test your API in other REST Clients.

    Your API is hosted on your local workstation from a z/OS Connect server that is exposed as https://localhost:9443/employees/{id}.

    You can use this URL in any REST client of your choice and it returns successful responses. If a REST client is not available to you, you can use the Swagger Editor within the Liberty server as demonstrated here. The Liberty server client is part of the ibm-zcon-designer image.

Results

You successfully tested your API.

What to do next

You can now continue to test with different mappings and explore the power of JSONata. You can explore more complex mappings in the next section of the tutorial: Define the GET operation for the /employees path.