Testing APIs
When you have finished configuring your API, Scheer PAS API Management allows you to test your implemented configurations.
Testing of API configurations is only possible with REST APIs that are coming with an OpenAPI specification.
There are slight differences between the testing of a public API and the testing of a private API:
Private APIs are only accessible for known consumers, called Clients in API Management context. For private APIs, a contract must be created between the client and the API it wishes to consume. If you want to test a private API, you need to test it via one of the created clients.
Public APIs can be invoked by any consumer. However, API Management still allows to restrict access to public APIs by adding Policies.
While testing, you can check if the API is invokable. If you have configured policies for an API, you can also check if these policies are applied correctly.
API Definition
To test an API with API Management, you need to provide an API definition in OpenAPI specification. For more information on API definitions, refer to API Settings > API Definition.
If the API has been imported from the PAS Administration, the definition file should have been added automatically.
Testing the API
The process of testing itself is the same regarding public and private APIs. For each published API, option Try! is enabled in tab Overview. Click it to open the test interface:
If your API is public, you are redirected to the test page (see Testing below) in the API Developer Portal:
If your API is private, you are redirected to tab Contracts because various contracts can exists for a private API. In the list of active contracts you can now choose the one you want to test: Simply click Try! to open the test interface:
You are redirected to the corresponding test page (see Testing below) in the API Developer Portal:
Testing
You can use the test page (Swagger UI) to make test calls to your service. Open the method you want to test and click Execute:
For more information about the functions of the Swagger UI, refer to the Swagger homepage.
You can also use the API Developer Portal to access the Swagger UI and make your test calls (refer to chapter Developer Portal for further information).
Click API Documentation on an API tile...
...or on the details page of an API:
Testing with Authorization
If you are using the JWT or Keycloak OAuth policy, an authentication dialog is shown in the API Developer Portal that you need to use to consume the API. To support you during testing, API Management provides the default user token. If you open the API Documentation in the Developer Portal, the lock icon in button Authorize is closed - you can directly start testing:
Click Auhorize to open the dialog if you want to make your own entries. These are then used in preference to the default: