In the upper right of the z/OS Connect Designer window, click
Test.
Figure 1. Location of the Test button.
The Open Liberty REST Client opens in a new tab in
your browser. The Open Liberty REST Client opens your
OpenAPI definition automatically, ready to be tested.
Table 1. Test API button status
Indication
Status
Enabled. Click the button to test your API.
Button is unavailable with a loading indicator. The project build is
running.
Button is unavailable with an error indicator. The project build failed. Hover
over the button to see error information. For example,
Figure 2. The Open Liberty REST Client available
from the Liberty server with your OpenAPI definition
loaded.
The editor lists the paths of your z/OS Connect API
that are available to test. The Open Liberty REST Client acts as an HTTP client to test
your OpenAPI by sending a RESTful request to your
resources.
Test the PUT /phonebook/contacts/{lastName} operation.
Click anywhere on the PUT /contact operation bar to expand the
PUT /contact operation.
Click Try it out in the upper right of the operation
section.
Enter any name that exists in the phonebook in the
lastName field.
Smith
In the request body field, input the details of the contact you want to update by
using the following JSON request format:
Figure 3 shows the result of a
successful test. You can verify that the order was processed by using the
/contacts operation, by viewing the response field stock and
verifying that the count goes down by the quantity ordered. A failed test result is shown in Figure 4.
Figure 3. A successful test result.
Figure 4. A test result for a contact not in the phonebook
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/phonebook/contacts/Smith.
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, use the Open Liberty REST Client 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.