Introduction
This section explains how to test an API application using a Rest API client (e.g. SoapUi and Postman). In our case we will use SoapUI as Rest API client.
The following topic modules are considered in more detail in this tutorial:
- Change Resource Configurations
- Testing in SoapUI
Change Resource Configurations
Switch to the Service Development perspective and refresh (F5 → Right click on a package and select refresh) the Package Navigator view. To customize Resource Configurations, click on the desired resource. Then you can edit Rest resources (e.g. Supported HTTP methods). To do this, select a resource from the list and click edit.
Now you can specify for example which http methods should be supported.
Testing a provided API
To perform an instant test, launch SOAP UI from the Windows Start menu. Then select File and New REST Project.
Provide http://localhost:5555/restv2/Resourcename/Programname as initial REST service URI and click OK.
You can also copy the URI from the resource in the service development perspective. To do this, open the corresponding resource and look in the properties and resource configurations.
In the Navigator, now rename the generated REST project (e.g. REST Employees), the method (in our case Employees) and rename the generate request (in our case Employees).
Then double-click the generated request in the Navigator and provide the following parameters for the REST request:
- Mehtodtype: GET
- Request properties tab
- Username: Administrator
- Password: manage
- Request header
- Request header (click on headers to add a header name): Accept
- Request header value: application/json
Methodtype:
Username + password:
Request header:
- Add HTTP Header:
- Enter header value:
If you have entered all the parameters just mentioned click on the green arrow to submit the request. Open tab Raw of the response to see the HTTP response code. In case of success (200), the REST service should return a list of employees in JSON format. Therefore switch to the JSON tab of the response.
Conclusion: Most Important Facts
- Rest API Clients: SoapUI, Postman, etc.
- The following parameters must be adjusted for the REST request before starting it
- Method: GET
- Username: Administrator + Password: manage
- Request Header: Accept + Request Header value: application/json
With this tutorial you have successfully completed our series and have a better overview of how the various Software AG (Adabas, Natural, NaturalOne, EntireX, webMethods) products work together on the topic of API. Now you can try out the things you have learned yourself. Have fun!