Get Started with APIs

These instructions show you how to create an API client and configure credentials to access Akamai APIs. For this exercise, you’ll use the HTTPie command-line client because it’s an easy way to make API calls.

Required setup

  • In order to create an API client, you need access to Luna with permission to manage API authorizations. If you don’t have this permission, contact an Akamai administrator within your company and ask them to create the API credentials for you.

  • In order to complete this exercise, install the EdgeGrid HTTPie plug-in.

Create an API client

You need to create an API client in Luna for each Akamai API you want to use.

If your Luna administrator gave you credentials for the API, skip to add credential to edgerc file.

  1. Launch Identity Management in Luna (CONFIGURE ⇒ Manage APIs).

  2. Click New API client for me.

  3. Click Next.

  4. Enter a name and a description for the client.

  5. Search for the Diagnostic Tools API and select READ-WRITE for the access level.

    NOTE: For this exercise, you’ll only use one API, but you could create an API credential to access several APIs, with different access levels for each.

  6. Click New credential.

  7. On the New credentials screen, click Download client tokens.

Add credential to edgerc file

Before you can access the API, you need to configure the file that contains the credentials. The credential includes the client token and client secret required to authenticate Akamai API requests.

  1. Open the file you downloaded in a text editor.

  2. Add a line above the credentials as follows: [default].

    NOTE: You can add credentials to this file as needed. Separate each set of credentials with a [header] as shown.

  3. Save the file in your home directory with the name .edgerc.

Make API calls

For this exercise, you’ll use HTTPie to make a simple dig IP address lookup request with the Diagnostic Tools API.

  1. Request the locations of servers in the Akamai network that can run the diagnostic tools.

    $ http --auth-type edgegrid -a default: :/diagnostic-tools/v2/ghost-locations/available
    

    STEP RESULT: You receive a 200 OK response with the location results.

  2. Execute a dig command to get IP address information for developer.akamai.com in one of the locations. For this example, use Perth, WA, Australia (perth-wa-australia).

    $ http --auth-type edgegrid -a default: ":/diagnostic-tools/v2/ghost-locations/perth-wa-australia/dig-info?hostName=developer.akamai.com&queryType=A"
    

    STEP RESULT: You receive a 200 OK response with the dig results.

  3. Run the Dig command again, choosing a different locationID from the Ghost location results. For more information, refer to the Run dig from a Ghost Location operation.

Congratulations, you’ve successfully executed Akamai API calls!

NOTE: If you need to create a client to manage multiple accounts, refer to the Manage many accounts with one API client guide.

Resources

In this exercise, you discovered how easy it is to make API calls with Akamai.

Here are some resources you can use to extend these skills and apply them to improve your web application delivery and performance.