PAPI Tricks and Tips: Use a Datastore to Access Property Info Quickly

by Kirsten Hunter
1510

As an API Evangelist, I travel around the world to visit our customers and help them get up and running with our APIs. While doing this, I collect requests to bring back to our engineering teams and sometimes come up with different ways for customers to interact with our platform.

Your Most Popular Requests

Some of the requests I was hearing most frequently were:

  • How can I do a diff between different properties and versions?
  • What properties are associated with a specific cpcode?
  • How can I tell which properties have a particular feature enabled?

This information is available via Luna and the API, but there aren’t easy ways to answer the questions in a timely fashion, and I’m always looking for ways to improve our customers’ experience with our products.

Storing Property Information

With that in mind, I created a tool to generate a git repository, storing property information for an account. It’s available in our open source repository.

  • Each property has its own branch name based on the property name (www.example.com).
  • Rules, hostnames, and activations are stored as separate files.
  • The git utilities such as sort, log, and diff can be used to interact with the data.
  • Since it is a self-contained directory, the information can be shared with others without giving direct access to the Akamai API system.

I’ll mention that this is an actively developed prototype. Because the process is gathering information for all your properties and versions, the first run with the tool can take several hours or even days (!) to run through all of the data for your account. You can run it periodically and it’ll be much faster (usually less than a couple of minutes) – it checks to see if there’s new versions before performing any expensive requests.

Running the Tool

In order to run the tool, you’ll want to go through the Get Started tutorial to set up credentials. Create a set of credentials at the account level for property manager (read-only is fine) and setup your .edgerc file to use the section “papi”.  The script will run (for a long time) and create a git repository in the “datastore” subdirectory of your current directory. You can edit the code to move this elsewhere as desired, of course.

Here’s the Fun Part: Queries

What kind of queries can you perform? Here are just a few examples of potential queries. Please feel free to post on the developer forum if you have other suggestions or requests!

Tell me all the properties and CPCodes

 

What properties use a specific CPCode, or have a specific feature activated?

 

What was the last activation before a certain date?
If your property was working great on June 1, but is broken now, you need to know what was changed since then:

 

And the most popular and exciting function is diff.
Note that all commits are tagged with branch@version so you can do diffs between properties as well as within a specific property.

Try it!

Run this for your properties and check it out. It will give you a better way to explore your properties and versions, and should make it much easier to manage your installation. Please drop us a note if you want something added or changed, and feel free to open issues on the git repository if you find them.

 

Categories: Technology

Suggested Article

LEAVE A REPLY