Create an operation to get details of a single employee

Create an operation to get information about a single employee

Before you begin

Transfer the employeeDetails.sar file, in binary mode, to the workstation where the API toolkit is installed.

About this task

This operation is implemented as an HTTP GET request and shows you how to use the employeeDetails service to expose an individual employee's details.

Procedure

  1. Select the projectManager API tab and click Add a new path next to Path to add a new path.
  2. Enter /employees/{employeeNumber} into the path and delete the POST and DELETE methods.
  3. Click Service... for the GET method to select the service archive file that defines the service on this API path that is called by an HTTP GET request.
    The Select a z/OS Connect Service dialog opens.
  4. Click Workspace or File System, depending on where your employeeDetails.sar file is located, and select it to import it. Click Open.
    The Import Services dialog opens.
  5. Click OK.
    The operation now maps to the employeeDetails service.
    Screen image of the API Editor shows employeeDetails service defined for GET method
  6. From the menu bar, select File > Save.
  7. Click Mapping... for the GET method that uses the employeeDetails service.
  8. Click Open Both Mappings.
    The request and response mapping editors open so that you can define the mappings between the content of the API's HTTP request and response and the JSON content passed to and from the IBM® z/OS® Connect service.
  9. In the request mapping, create 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, by dragging from the path parameter employeeNumber to the JSON property employeeNumber.
    Screen capture showing the completed request mapping.
  10. In the response mapping, create a Remove transform for the JSON property StatusCode by right-clicking on the JSON property and selecting Add Remove transform. This removes the property from the API response.
    Screen capture showing the completed response mapping.
  11. Save and close the request and response mapping files.