Testing a REST-API Connection
Install a REST-API client
Install a client to send test requests to the REST API.
- Recommended: Postman (free)
- Alternative tools: cURL (command-line), Insomnia
curl -X GET "https://api.example.com/v1/data" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"Gather connection details
Before connecting, make sure you have the following details:
- API Reference/Documentation Obtain the official REST API documentation (webpage or document).
- Request/Load Limitations Check for any restrictions, e.g., 100 requests/hour.
- Connection Details
- Endpoint Address: IP address and TCP port.
- Credentials (examples below):
- Basic Auth: Username & Password
- Identifier & Secret
- Bearer Token
- OAuth2 Credentials:
- Client ID & Client Secret, or Base64 token (identifier:secret encoded)
- Username & Password
- OAuth Scope (if non-default) – defines granted privileges
- Custom Authentication: May require development effort.
Perform a request and get a 200 status code with data in return
- Open your REST-API client and create a new request.
- Set method & endpoint:
- Select GET (or the method required by the API).
- Enter the full enpoint.
- Example: https://api.example.com/data
- Authentication:
- Go to the related authentication tab.
- Select the required auth type (Basic Auth, Bearer Token etc.).
- Enter your credentials or token.
- Headers (if needed):
- Add Content-Type: application/json or any required custom headers.
- TLS validation:
- Enter the TLS settings.
Disable validate certificate in your REST-API client if there are no valid TLS certificate served by the REST API (self-signed TLS certificate = invalid).
- Perform a test request.
- Expect an HTTP 200 OK response.
- Verify that the response body contains the data you intend to collect.
Troubleshooting API connection
Permission denied or 401 Unauthorized
- Could be caused by invalid credentials (expired token, wrong username/password).
- Double-check credentials (token, username/password, client ID, client secret etc.).
- Re-issue or refresh authentication tokens if expired.
- Consult the API documentation for required parameters.
Couldn't resolve host name
- Check the host name.
- If DNS is used check if VPN is required to have access.
- Test network reachibility: ping or curl to the endpoint.
Rate limits exceeded (too many requests in a short time)
- Consult the API documentation for required parameters.