Welcome!

Web Performance is a Journey, Not a Destination

Mehdi Daoudi

Subscribe to Mehdi Daoudi: eMailAlertsEmail Alerts
Get Mehdi Daoudi via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Blog Feed Post

Pull Catchpoint Data into Google Docs with New API

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 – http://io.catchpoint.com. 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!

 

Fastly OpsCast ad

The post Pull Catchpoint Data into Google Docs with New API appeared first on Catchpoint's Blog.

Read the original blog entry...

More Stories By Mehdi Daoudi

Catchpoint radically transforms the way businesses manage, monitor, and test the performance of online applications. Truly understand and improve user experience with clear visibility into complex, distributed online systems.

Founded in 2008 by four DoubleClick / Google executives with a passion for speed, reliability and overall better online experiences, Catchpoint has now become the most innovative provider of web performance testing and monitoring solutions. We are a team with expertise in designing, building, operating, scaling and monitoring highly transactional Internet services used by thousands of companies and impacting the experience of millions of users. Catchpoint is funded by top-tier venture capital firm, Battery Ventures, which has invested in category leaders such as Akamai, Omniture (Adobe Systems), Optimizely, Tealium, BazaarVoice, Marketo and many more.