Create an operation to list employees

Create an operation to list employees

Before you begin

If the employeeList.sar file was generated on a different workstation, transfer the 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 expose a resource for the employeeList service.

Procedure

  1. Rename the default Path value to be /employees by typing over the existing value.
  2. Remove the POST, PUT and DELETE methods by clicking on the Remove a method at the end of the line. This should leave only the GET method allowed for the path /employees.
    Screen image of API Editor dialog used to create an API with a single operation for a list of employees.
  3. Click Service... for the GET method to import the employeeList.sar file.
    The Select a z/OS Connect Service dialog opens.
  4. Click Workspace or File System, depending on where your employeeList.sar file is located, and select it to import. Click Open.
    The Import Services dialog opens. Click OK. The employeeList service now appears in the Service dialog.
    Screen image of the dialog for selecting a service.
    Click OK. The operation now maps to the employeeList service.
    Screen image of the API Editor shows employeeList service defined for GET method
  5. From the menu bar, select File > Save.
  6. Click Mapping... for the GET method that uses the employeeList service. Click Open Default Response Mapping. The response mapping editor opens, so that you can define the mappings between the JSON content returned from the IBM® z/OS® Connect service and the response the API returns.
  7. 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.
    Screen capture showing how to create a remove transform for the StatusCode property.
    This removes the property from the API response.
    Screen capture showing the completed response mapping.
  8. Save and close the response mapping file.