The responses from the z/OS Asset must be mapped to the fields of the API
response. In the task, Define GET /employees responses you defined the order
in which the response codes are checked. You now map the data that is returned for each API
response.
The Operation flow diagram shows the responses that need to
be mapped. An amber exclamation mark icon indicates that the mapping is not
defined.
The GET/employees operation can return either a 200 or 500
response code. In the following steps, you configure each one of these responses to return the data
that you want.
Click 200 on the Operation flow diagram.
A 200 response indicates that the requested employee records were found
and the information is returned in an array. This data array must be mapped to the fields of the API
response.
Figure 1. 200 response node.
Map the returned ResultSet Output array.
The body of the 200 response is an array of the returned employees. You
pass in a returned array structure from the getEmployeesz/OS Asset.
Within the For each mapping input, do one of the following actions
Select the ResultSet Output node from the Input
selection window.
Enter the following
directly into the field.
$zosAssetResponse.body."ResultSet Output"
Figure 2. Mapping in the returned array.
Figure 3. The mapped array.
This configuration iterates over the returned ResultSet Output array that
contains the list of employees and maps the fields for each
employee within the array.
Map API Response bio field.
For each employee, add a small bio. This bio is a concatenation of their given and family
names.
Select the FIRSTNME input.
Notice when selecting from the Input selection window that it suggests a
selection from ResultSet Row item / Object. This is focusing the selection
for that array member.
Figure 4. Selecting the 'FIRSTNME' input.
Enter the syntax to concatenate the FIRSTNME and
LASTNAME inputs.
In the bio field after the already selected
FIRSTNME, add a space then start typing lastname and
select LASTNAME from the menu.
Figure 5. Concatenating fields.
Continue typing to build the sentence FIRSTNAMELASTNAME works in WORKDEPT.
As you type,
Designer continually searches for matching field names.
Figure 6. Completed mapping.
Map remaining the API response fields
In the same way as previous steps, you can choose to map the corresponding fields between the z/OS Asset and the API response.
Figure 7. Completed 200 response.
Click 500 on the Operation flow diagram.
A 500 response
indicates an internal server error. Configure the 500 response to return the error code and the
contents of the StatusDescription field by typing the following into the
message field: