Create an operation to get details of a single employee
Create an operation to get information about a single employee
Before you begin
About this task
employeeDetails
service to expose an individual employee's details.Procedure
-
Select the projectManager API tab and click
next to Path to add a new path.
- Enter /employees/{employeeNumber} into the path and delete the POST and DELETE methods.
- 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.
- 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.
- Click OK. The operation now maps to the
employeeDetails
service. - From the menu bar, select .
- Click Mapping... for the GET method that uses the
employeeDetails
service. - 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.
- 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 propertyemployeeNumber
. - 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. - Save and close the request and response mapping files.