API Testing Tools

Below you can find out how to test API endpoints using different tools.  

Postman

With Postman, you can use the following API collections that can be downloaded here.

When downloaded, you can drag-and-drop the JSON file into your Postman window, or load it by using the Import function.

Before start invoking any API endpoint you have to configure the collection variables.

DPS API Variables

  • baseURL: the base API URL related to the target environment.

  • tenantName: the name of the tenant you want to connect to (e.g. acme).

  • apiKey: the key used to make API requests.

According to the authentication method you should edit different variables:

  • Login with credentials:

    • userEmail:the email address of the DPS user.

    • userPassword: the private password of the DPS user.

  • Login with PAT:

    • userPat: the PAT (Personal Access Token) to be used in alternative to user credentials (email and password).

Once variables have been provided, you can start testing the API endpoints without having to manage tokens or special headers (e.g. X-Servitly-Tenant).  

Automatic token management

The collection declares a post-response script which automatically updates the authentication variables:

  • bearerToken: the token sent in the Authorization header for each authenticated endpoint.

  • refreshToken, userId, tenantId: these variables are used by the logout and renewToken endpoints.

HTTP Connector Variables

  • httpConnectorBaseUrl: the base API URL of the HTTP Connector endpoints related to the target environment.

  • basicAuthUsername: the username configured in the HTTP Connector mapping of a thing.

  • basicAuthPasswor: the password configured in the HTTP Connector mapping of a thing.

Environments

In case you are working on multiple environment (e.g. DEV, STAGING, PRODUCTION) here below you can find the variable sets for each environment type.

Simply download the ones you need and drag them into the Postman window, or use the import function inside the Environments section of your workspace.

AWS

AZURE

Into Postman, within an Environment you can redefine variables, for instance apiKey, userEmail, userPassword, userPat.

When testing and API you can select the target environment.

Swagger UI

The Servitly API definitions is also available in the OpenAPI format (version 3.1.0) that can be downloaded here.

In the alternative, you can use the online Swagger UI tool:

Note that, with the Servitly DPS API, the bearer token must be manually provided and cannot be automatically extracted by the login response.
For this reason we suggest you use the Postman collection which uses the post-request script to update variables automatically.