Objective
This article will give you an example of how to create an API transaction script to access the Catchpoint Rest API.
Prerequisites
- Access to Catchpoint portal
- Access to Catchpoint Rest API.
- Consumer Key and Secret. Learn how to generate Key and Secret.
Process
- Login to the portal.
- Create an API transaction test.

- Copy/paste the script given below to the script editor.

- Click Save
Script:
NOTE:You will need to change the key and secret values to point to a different account.
// Step - 1
open("https://io.catchpoint.com/ui/api/token")
setNavigatePostData("grant_type=client_credentials&client_id=<ClientIDHere>&client_secret=<ClientSecretHere>")
var token = ${extract('resp-content','regexp:access_token":"([a-zA-Z0-9]+\S+)"')}; var tokenEncoded = ${base64("${var(token)}")};
// Step - 2
//The request will pull the nodes' information
open(https://io.catchpoint.com/ui/api/v1/nodes)
setHeader("authorization", "Bearer ${var(tokenEncoded)}")