Accessing the Eggplant Web Performance Analyzer API

The API can be used to extract data programmatically from Eggplant Web Performance Analyzer. You can also use the API to generate local dashboards or to integrate Eggplant Web Performance Analyzer and performance checks into your continuous integration or continuous deployment solutions.

API Path

With the exception of authentication, which is detailed below, you make all Eggplant Web Performance Analyzer API requests to the following base URL:

https://api.pa.eggplant.cloud/pa/v1

Requests must use HTTPS. Note that /v1 refers to the version of the API being used.

Authentication

To access the API, you must set up a client that provides you with a client ID and secret that your application uses to generate an authentication (bearer) token. You use the bearer token with each request you make to the API.

You can embed the client ID and secret in your application. There is never any need to include your login username and password in your client application.

You manage your client information (client ID and client secret pair) in the Client Credentials portal, which ensures that you always have control over which client applications are running with your user privileges. You can revoke access at any time.

Create a Client

  1. Log in to the Client Credentials portal using your regular portal login username and password.
  2. Create your client ID and client secret in the Add Client section. Enter a description for the client, then click Generate Keys.
  3. Take a note of the generated client ID and client secret. You can now log out of the Client Credentials portal, as it is not needed for API requests.
  4. Use the client_id and client_secret you generated to request a bearer token.

Request

Method POST
Path https://api.pa.eggplant.cloud/authorisation/token
Header Authorization: Basic {base64 encoded client_id:client_secret}
Body grant_type=client_credentials

Authentication is via standard HTTP basic authentication, where the request header needs to include a base64 encoded string of your client_id and client_secret, separated by a colon character.

For example, if your client_id is client and your client_secret is secret, then you would encode the whole string client:secret in base64, which is Y2xpZW50OnNlY3JldA==

Response

Body

{

"access_token": "gdjgurtyiuerytiuertyiuteyituruie",

"token_type": "Bearer",

"expires_in": 43200

}

Parameters

Parameter Details
access_token The token you use in all subsequent API requests, as documented in each of the requests.
token_type Describes the type of token in the response, which will always be Bearer.
expires_in Defines, in seconds, how long the token is valID

If you attempt to use a bearer token that has expired, or where the client has been revoked, you will see an HTTP 401 Unauthorized response and will need to reauthenticate or set up a new client as described above.

Working with Realms

All requests to the API must include the ID of the realm that you want to get data from. The Performance Analyzer account that you select when you log into the Portal Hub is equivalent to the realm that you will reference when using the API.

The Client Credentials portal lists the ID of the realm for each account you have access to:

The Client Credentials portal lists the IDs of realms for accounts you have access to

In this example, the Acme Production account has a realm of 12345, which can be used in any subsequent API requests.

If you want to programmatically identify the ID of the realm to use for a particular account, you can make a request to the API as follows:

Request

Method GET
Path https://api.pa.eggplant.cloud/authorisation/user?service=6
Header Authorization: Bearer {access_token}

When using the API for Eggplant Web Performance Analyzer, the service is always 6, so use that to query for your realms.

Response

Body

{

"realms": {

"12345": {

"label": "Acme Production",

"service": "6",

...

},

...

},

"info": {

"fullName": "Joe Bloggs",

"emailAddress": "joe.bloggs@mydomain.com"

},

"roles": [

"MONITORING",

"USER_ADMIN",

"ACCOUNT_ADMIN",

"RT",

"PA"

]

}

In this example, the Acme Production account has a realm of 12345, which can be used in any subsequent API requests.

 

This topic was last updated on August 19, 2021, at 03:30:47 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant