DEV Community

Tech Community for Software AG Tech Community

Posted on • Originally published at tech.forums.softwareag.com on

REST API Client - Testing a provided API

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.

Overview_components_APIClient

The following topic modules are considered in more detail in this tutorial:

  1. Change Resource Configurations
  2. 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.

change resource configurations

Now you can specify for example which http methods should be supported.

Edit REST Resource Operation

Testing a provided API

To perform an instant test, launch SOAP UI from the Windows Start menu. Then select File and New REST Project.

New REST Project

Provide http://localhost:5555/restv2/Resourcename/Programname as initial REST service URI and click OK.

provide URI

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.

Resource properties

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).

Navigator - renaming

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:

Methodtype

Username + password:

password and username

Request header:

  1. Add HTTP Header: add http header
  2. Enter header value: add header value

If you have entered all the parameters just mentioned click on the green arrow Submit request 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!

Read full topic

Top comments (0)