Getting Started with the AGILITY API

Getting Started with the AGILITY API

What is the AGILITY API?

The AGILITY API enables developers and system integrators to seamlessly integrate AGILITY's network trace analysis capabilities into existing tools and workflows. By automating the ingestion and analysis of network captures, teams can accelerate troubleshooting and identify root causes more efficiently.

:card_box: Supported file formats include .pcap, .pcapng, .cap, and .zip.

This guide provides the information you need to get started quickly and effectively, including:

Before You Start

Before using the AGILITY API, ensure you have the required credentials and permissions provided by your administrator, including a valid username and password.

If you are using the AGILITY Community Edition, you must create an account using your email address. Accounts created through LinkedIn or Google authentication are not supported for API access.


:computer: API Base URL

Use the following endpoint to access the AGILITY OpenAPI documentation, where you can explore available APIs, review request and response schemas, and test API operations.

:link: URL Format: http(s)://<YOUR_PUBLIC_DN>/cv/api/public/docs

Example: https://agility-community.b-yond.com/cv/api/public/docs

 


:closed_lock_with_key: Authentication

To securely access the AGILITY API, you must first authenticate and obtain an access_token. AGILITY uses the OAuth 2.0 Password Flow, which allows you to generate a token with your username and password. Once obtained, the access token must be included in all API requests.

Request an Access Token

Before accessing any AGILITY API endpoints, you must obtain an OAuth 2.0 access token. The token is generated using your AGILITY credentials and must be included in the Authorization header of all subsequent API requests.

This section describes the authentication endpoint, required headers, and request body, a sample cURL request, the expected response, and how to handle token expiration.

Authentication Endpoint

Use the following endpoint to request an access token:

POST /cv/auth/realms/agility/protocol/openid-connect/token

Include in your request, your:

  • username

  • password, and

  • client_id (agility-automation-cli), and

  • client_secret (environment-specific secret for the agility-automation-cli client; request it from your AGILITY administrator)

  • The client secret is stored in Kubernetes as Secret agility-keycloak-automation-cli

  • kubectl -n <ns> get secret agility-keycloak-automation-cli \
    -o jsonpath='{.data.client-secret}' | base64 -d

Request Headers

Header

Value

Header

Value

Content-Type

application/x-www-form-urlencoded

Request Body

Parameter

Description or Value

Parameter

Description or Value

grant_type

Must be set to a password

client_id

agility-automation-cli

client_secret

 

username

Your registered AGILITY username

password

Your registered AGILITY password

scope

openid

Example cURL request

curl -X POST https://cv-dev.b-yond.com/cv/auth/realms/agility/protocol/openid-connect/token \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=password&client_id=agility-automation-cli&client_secret=YOUR_CLIENT_SECRET&username=YOUR_USERNAME&password=YOUR_PASSWORD&scope=openid"

Replace YOUR_USERNAME, YOUR_PASSWORD, and YOUR_CLIENT_SECRET with the username, password, and agility-automation-cli client secret associated with your AGILITY account. Request the client secret from your AGILITY administrator.

Example Response

Upon successful authentication, the API returns a JSON response containing an id_token, a refresh_token, and other authentication details.

  • Use the value of id_token as a Bearer token in the Authorization header of all subsequent API requests.

  • Store the refresh_token securely, as it can be used to obtain a new id_token when the current token expires, as described in the next section.

{ "access_token": "ACCESS_TOKEN_VALUE", "expires_in": 300, "refresh_expires_in": 1800, "refresh_token": "REFRESH_TOKEN_VALUE", "id_token": "YOUR_ID_TOKEN", ... }

In this example, the access token expires after 300 seconds (5 minutes), and the refresh token expires after 1,800 seconds (30 minutes). Use the refresh token to request a new access token when the current one expires.

Your id_token, access_token, and refresh_token grant access to AGILITY resources and should be handled securely. Store these tokens in a secure location and avoid exposing them in client-side applications, source code repositories, logs, or any publicly accessible environment.

Refreshing an Expired Token

When an access token expires, the AGILITY API will no longer authorize API requests. To restore access, you can request a new token using a valid refresh_token. If the refresh token has also expired, you must authenticate again using your username and password.

Using the refresh token flow helps maintain uninterrupted access to the API without requiring users to re-authenticate each time an access token expires.

1. Make a Refresh Token Request

To obtain a new token:

  1. Send a POST request to the token endpoint.

  2. Set the grant_type parameter to refresh_token.

  3. Provide the refresh_token received during the initial authentication process.

Example Request:

POST /cv/auth/realms/agility/protocol/openid-connect/token Content-Type: application/x-www-form-urlencoded grant_type=refresh_token &refresh_token=[Your Refresh Token] &client_id=agility-automation-cli &client_secret=[Your Client Secret] #confidential, environment-specific value; request it from your AGILITY administrator

 

2. Receive a New Token

If the refresh token is valid, AGILITY will return a new id_token along with updated token details. Depending on the authentication configuration, a new refresh_token may also be issued.

Example Response:

HTTP/1.1 200 OK Content-Type: application/json { "access_token": "[New Access Token]", "expires_in": 300, "token_type": "Bearer", "refresh_token": "[New Refresh Token]", "refresh_expires_in": 1800, "id_token": "[New Id Token]", // ... other token information }

 

3. Update Your Authorization Header

Replace the expired token with the newly issued id_token in the Authorization header of all subsequent API requests.

Important Security Note

Store refresh tokens securely and treat them as sensitive credentials. Because refresh tokens can be used to obtain new access tokens, they should never be exposed in client-side code, logs, source code repositories, or other unsecured locations.


:arrow_right: Next: Use the API endpoints.