Try an API
The Developer Portal includes a built-in API testing feature that lets you send requests to API endpoints directly from your browser. This helps you explore and validate APIs before integrating them into your applications.
Prerequisites
- A Developer Portal account with an active status.
- An application subscribed to the API product you want to test.
- A valid credential that matches the API product's authentication type.
Send a Test Request
-
Log in to the Developer Portal.
-
Navigate to the API Hub and select the API product.
-
Browse to the endpoint you want to test.
-
Click Try It Out (or Test Request).
-
The authentication type is pre-selected based on your credentials. If the API product supports multiple authentication types, select the one that matches your credential.
-
Your credential is automatically populated (for example, the API key or basic auth credentials).
-
Configure the request parameters:
Parameter Description Path parameters Fill in required URL path segments. Query parameters Add query string parameters. Headers Add or modify request headers. Request body Enter the request body for POST, PUT, and PATCH requests. -
Click Send.
Review the Response
After sending a request, the portal displays:
- Status code: The HTTP response status (for example, 200, 401, 404).
- Response headers: The HTTP headers returned by the server.
- Response body: The response payload, formatted for readability.
Troubleshooting
CORS Errors
When testing APIs from the browser, you may encounter CORS (Cross-Origin Resource Sharing) errors. This happens because browsers enforce CORS restrictions and send a preflight OPTIONS request. If the gateway route does not allow the OPTIONS method or the CORS plugin is not enabled, the browser blocks the request.
To resolve CORS errors:
- Ask the API provider to enable the
corsplugin on the relevant routes or globally. - When the CORS plugin is configured globally, preflight
OPTIONSrequests are handled automatically.
Authentication Errors
If you receive a 401 Unauthorized response:
- Verify that your subscription is active (not pending approval).
- Verify that your credential type matches the API product's authentication type.
- If using OAuth, verify that your access token is not expired.
- If using key authentication, verify that the API key is correct and has not been regenerated.
Endpoint Not Found
If you receive a 404 Not Found response:
- Verify that the endpoint path matches the API documentation.
- Verify that the
Hostheader matches one of the hosts configured on the linked service. - Check that the HTTP method matches the endpoint specification.