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.
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.
Launch Identity Management in Luna (CONFIGURE ⇒ Manage APIs).
Click New API client for me.
Enter a name and a description for the client.
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.
Click New credential.
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.
Open the file you downloaded in a text editor.
Add a line above the credentials as follows:
NOTE: You can add credentials to this file as needed. Separate each set of credentials with a
Save the file in your home directory with the name
Make API calls
For this exercise, you’ll use HTTPie to make a simple dig IP address lookup request with the Diagnostic Tools API.
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.
Execute a dig command to get IP address information for
developer.akamai.comin 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.
Run the Dig command again, choosing a different
locationIDfrom 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.
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.