Test REST API using Postman or Curl
This set of instructions explains how to access the Litmus Edge APIs using an external tool: curl command or Postman.
API tokens are unique authentication credentials assigned to individual users. You can create API tokens to use the Litmus Edge REST APIs.
The back-end APIs communicate with the front-end interface through HTTP REST.
If you want to use a custom interface or some other custom application to access the underlying APIs, the Litmus Edge API Keys Management allows you to create an API token.
When accessing an exposed API, you can use the same API token for any of the exposed APIs.
To access API documentation, contact your Litmus representative.
For the example below, we will test the DeviceHub version of your Litmus Edge instance.
- Validate the API token from the Action menu of the API Token. See Manage API Credentials to learn more.
- Copy the API token (click the Copy icon next to the API token value). See Manage API Credentials to learn more.
You can manually test a REST API with the Postman application.
You will need to install and open Postman.
To use Postman to view the component version:
- Open Postman or access the web version of Postman.
Make sure that GET is selected from Action drop-down list.
- Enter the API endpoint to verify the component version: [Litmus Edge IP address]/[component name]/version. For example, https://192.168.0.148/devicehub/version.
Click the Authorization tab.
From the Type drop-down list, select Basic Auth.
- Paste the Litmus Edge API token in the Username field. Leave the Password field blank.
- Click Send.
Review the version number in the response.
See the Verify Response section below to cross-reference the component version in Litmus Edge.
You can use a command prompt window to manually test a REST API.
In a command prompt window, enter the following command.
In the command above:
- Replace d7izh3c4w1nwow0yvz1ypjq6h2soaoxm: with your own Litmus Edge API token. The format username:password is used, but because we aren't entering a password, no characters are needed after the colon (:).
- Replace 192.168.0.147 with your own Litmus Edge IP address.
- The -k parameter allows you to use basic authorization to access the API.
- The -u parameter defines the user for the command, which is the Litmus Edge API token.
The response should display something like the following.
{"version":"2.18.4","git":"0d44345d94e9"}
Complete the steps below to cross-reference the component version in Litmus Edge.
To verify the response:
- Copy the version number in the API response from the previous step.
In Litmus Edge, navigate to System > Support and refer to the Status section.
Cross-reference the version number from the API response and the version number for DeviceHub API. The version numbers should match.