Blog Post

Pull Catchpoint Data into Google Docs with New API

Published
June 30, 2015
#
 mins read
By 

in this blog post

Google Apps Script allows you to programatically create and modify Google Docs, as well as customize the user interface with new menus, dialog boxes, and sidebars.

Here, we will walk you through how to pull Catchpoint data into Google Sheets using Apps Scripts.

Firstly, you will need to configure the Catchpoint Pull API in the portal. Login into the Catchpoint Portal and head to Settings -> API.

Set the Pull API to Active and click Add Consumer. Complete the form by providing a Name and a Contact, you do not need to configured Allowed IPs. Click Save. This will generate a Key and a Secret that you will need when building your Google Apps Script.

PullAPI1

PullAPI2

Next, you will need to have a Google account and sign into Google Docs – http://docs.google.com.  Once signed in create a new Sheet. In the Sheet menu goto Tools -> Script Editor

PullAPI3

Under Create script for select Blank Project. The editor will load with a skeleton script (Code.gs) and function called myFunction()

Change of the name of this function to ‘onOpen()’ this will cause the function to run when the spreadsheet is opened.

Next, configure the variables that will be used to make the initial call to get the authentication token. This token is required to make calls to the Catchpoint Pull API. More details can be found in the documentation in the Catchpoint Portal. In the code below replace ‘your_key’ and ‘your_secret’ with the Key and Secret you created in the Catchpoint portal.

PullAPI4

Once the options have been configured you need to make the call to the token URL, parse the JSON response returned and base64 encode the returned token.

PullAPI5

With the token now stored in the correct format we are ready to make a call to the API. In this example we will fetch a list of current tests running in Catchpoint.

The following code will pass the token to the API and return a JSON response containing the running tests.

PullAPI6

Next, configure the script to use the current active sheet in Google Docs.

PullAPI7

Next, the returned JSON data needs to be parsed and pushed into the sheet along with column headings.

PullAPI8

You are now ready to save the script and test. Save the project and enter project name.

PullAPI9

Click the Run icon, at which point Google will request authorization for the app to run.

PullAPI10

Accept this request. The app will then run. Jump back to your spreadsheet and you will see it has been populated with a list of tests.

PullAPI11

This is just a basic example of getting the integration working. The above could be worked on to honour token expiration and refresh, additional functions to pull other API data into sheets, create graphs with test data etc.

The above skeleton is a great start to manipulating and visualising Catchpoint Data in Google Docs. Enjoy!

Google Apps Script allows you to programatically create and modify Google Docs, as well as customize the user interface with new menus, dialog boxes, and sidebars.

Here, we will walk you through how to pull Catchpoint data into Google Sheets using Apps Scripts.

Firstly, you will need to configure the Catchpoint Pull API in the portal. Login into the Catchpoint Portal and head to Settings -> API.

Set the Pull API to Active and click Add Consumer. Complete the form by providing a Name and a Contact, you do not need to configured Allowed IPs. Click Save. This will generate a Key and a Secret that you will need when building your Google Apps Script.

PullAPI1

PullAPI2

Next, you will need to have a Google account and sign into Google Docs – http://docs.google.com.  Once signed in create a new Sheet. In the Sheet menu goto Tools -> Script Editor

PullAPI3

Under Create script for select Blank Project. The editor will load with a skeleton script (Code.gs) and function called myFunction()

Change of the name of this function to ‘onOpen()’ this will cause the function to run when the spreadsheet is opened.

Next, configure the variables that will be used to make the initial call to get the authentication token. This token is required to make calls to the Catchpoint Pull API. More details can be found in the documentation in the Catchpoint Portal. In the code below replace ‘your_key’ and ‘your_secret’ with the Key and Secret you created in the Catchpoint portal.

PullAPI4

Once the options have been configured you need to make the call to the token URL, parse the JSON response returned and base64 encode the returned token.

PullAPI5

With the token now stored in the correct format we are ready to make a call to the API. In this example we will fetch a list of current tests running in Catchpoint.

The following code will pass the token to the API and return a JSON response containing the running tests.

PullAPI6

Next, configure the script to use the current active sheet in Google Docs.

PullAPI7

Next, the returned JSON data needs to be parsed and pushed into the sheet along with column headings.

PullAPI8

You are now ready to save the script and test. Save the project and enter project name.

PullAPI9

Click the Run icon, at which point Google will request authorization for the app to run.

PullAPI10

Accept this request. The app will then run. Jump back to your spreadsheet and you will see it has been populated with a list of tests.

PullAPI11

This is just a basic example of getting the integration working. The above could be worked on to honour token expiration and refresh, additional functions to pull other API data into sheets, create graphs with test data etc.

The above skeleton is a great start to manipulating and visualising Catchpoint Data in Google Docs. Enjoy!

This is some text inside of a div block.

You might also like

Blog post

Demystifying API Monitoring and Testing with IPM

Blog post

Prioritize Internet Performance Monitoring, urges EMA

Blog post

The cost of inaction: A CIO’s primer on why investing in Internet Performance Monitoring can’t wait