Product Features
...
Access Control
Tokens

Test REST API using Postman or Curl

5min

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.

Before You Begin

Option 1: Access REST APIs with Postman

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:

  1. Open Postman or access the web version of Postman.
  2. Make sure that GET is selected from Action drop-down list.

    The GET command
    The GET command
    
  3. 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.
  4. Click the Authorization tab.

    Authorization tab
    Authorization tab
    
  5. From the Type drop-down list, select Basic Auth.

    Basic Auth option
    Basic Auth option
    
  6. Paste the Litmus Edge API token in the Username field. Leave the Password field blank.
  7. Click Send.
  8. Review the version number in the response.

    API response
    API response
    

See the Verify Response section below to cross-reference the component version in Litmus Edge.

Option 2: Access REST APIs with Curl Command

You can use a command prompt window to manually test a REST API.

In a command prompt window, enter the following command.

Curl


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.

Verify the Response

To verify the response:

  1. Copy the version number in the API response from the previous step.
  2. In Litmus Edge, navigate to System > Support and refer to the Status section.

    Document image
    
  3. Cross-reference the version number from the API response and the version number for DeviceHub API. The version numbers should match.

    Document image