Querying Session PM data via API
  • 24 Apr 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Querying Session PM data via API

  • Dark
    Light
  • PDF

Article Summary

The user interface of Skylight performance analytics uses data retrieved via our OpenAPIs.


API Calls to Skylight analytics

If you aren't familiar with REST APIs, we recommend going to our intro page here to review that first.
To make API calls to Skylight performance analytics, follow these steps:

  1. Authenticate to obtain an Authorized Token.
  2. Make requests including an Authorized Token.

Get an Authorized Token - (Login API)

Authentication is based on a per-user basis, thus, to make API calls to Skylight analytics, you must have a user account and password for the tenant. You can also use JWTs for machine-to-machine integration (more on that here).

For a list of all Skylight performance analytics APIs available, the swagger definition file is served at https://api.analytics.accedian.io/ .

Once the user exists, the login API can be used to obtain an Authorized Token. The swagger definition can be found under the Auth Service here: https://api.analytics.accedian.io/session.html#operation/Login

A curl command to login would look like:

curl -X POST \
    https://tenant-url.npav.accedian.net/api/v1/auth/login \
    -H 'Cache-Control: no-cache' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'username=tenantUsername&password=tenantUserPassword'

When this command returns, it will include a couple of important headers:

  • Set-cookie: for browser based calls
  • Authorization: for API based calls

Both of these headers contain the same Authorized Token data. For anyone using our UI, the cookie will handle authentication going forward. For anyone using our APIs, they should extract the content of the "authorization" header, and provide it as an "authorization" header for all subsequent calls to Skylight performance analytics.

Make an Authorized API Request - (Aggregate Metrics API)

For example, when making a call for the average Delay P95 for all monitored objects from Skylight performance analytics that have metadata associated to them with the region "east", the following request could be made:

curl --location 'https://<tenant URL>/api/v3/metrics/aggregate' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Cookie: skylight-aaa=<cookie from previous step>' \
--data '{
    "data": {
        "type": "aggregates",
        "attributes": {
            "aggregation": "avg",
            "granularity": "all",
            "interval": "2023-06-13T05:29:10.010Z/2023-06-13T13:29:10.010Z",
            "globalMetricFilterContext": {
                "direction": [
                    "0"
                ],
                "metadata": {
                    "include": {
                        "region": [
                            "east"
                        ]
                    },
                    "exclude": {}
                },
                "objectType": [
                    "twamp-sf",
                    "twamp-sl",
                    "echo-icmp",
                    "echo-udp"
                ]
            },
            "metrics": [
                {
                    "metric": "delayP95",
                    "direction": [
                        "0"
                    ],
                    "objectType": [
                        "echo-icmp",
                        "echo-udp",
                        "twamp-sf",
                        "twamp-sl"
                    ]
                }
            ],
            "queryContext": {
                "ignoreCleaning": false,
                "focusBusyHour": false,
                "ignoreMaintenance": false
            }
        }
    }
}'

The response of this query would look like this:

{
    "data": {
        "attributes": {
            "aggregation": "avg",
            "globalMetricFilterContext": {
                "direction": [
                    "0"
                ],
                "metadata": {
                    "include": {
                        "region": [
                            "east"
                        ]
                    }
                },
                "objectType": [
                    "twamp-sf",
                    "twamp-sl",
                    "echo-icmp",
                    "echo-udp"
                ]
            },
            "granularity": "all",
            "interval": "2023-06-13T05:29:10.010Z/2023-06-13T13:29:10.010Z",
            "metrics": [
                {
                    "direction": [
                        "0"
                    ],
                    "objectType": [
                        "echo-icmp",
                        "echo-udp",
                        "twamp-sf",
                        "twamp-sl"
                    ],
                    "metric": "delayP95"
                }
            ],
            "queryContext": {},
            "result": [
                {
                    "direction": [
                        "0"
                    ],
                    "objectType": [
                        "echo-icmp",
                        "echo-udp",
                        "twamp-sf",
                        "twamp-sl"
                    ],
                    "metric": "delayP95",
                    "series": [
                        {
                            "timestamp": "2023-06-13T05:29:10.010Z",
                            "value": 7421.3430066787305
                        }
                    ]
                }
            ]
        },
        "id": "2aa12296-3e33-4123-9f2f-cc31e3f8515c",
        "type": "aggregates"
    }
}

© 2024 Accedian Networks Inc. All rights reserved. Accedian®, Accedian Networks®,  the Accedian logo™, Skylight™, Skylight Interceptor™ and per-packet intel™, are trademarks or registered trademarks of Accedian Networks Inc. To view a list of Accedian trademarks visit: http://accedian.com/legal/trademarks/. 


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.