Get Started with APIs

Create credentials in Control Center and make API calls over the Akamai network.

An API client contains authentication tokens that secure the interactions between your application and the Akamai platform.

These instructions show you how to create an API client and configure credentials. After that, you can use Akamai APIs and the Akamai CLI to make calls on the Akamai network.

Setup

Before you can make an API call on the Akamai network, you need:

  • Access to Akamai Control Center with the correct roles and permissions to create API clients and manage credentials. Contact an Akamai administrator within your company and ask them to create the API credentials for you if you don’t have either of these permissions in your role:

    • IDM: API Clients – User Access
    • IDM: API Clients – Admin Access
  • EdgeGrid HTTPie plug-in installed

Create an API client

For this exercise, you’ll create an API client for yourself and use only the Diagnostic Tools API to make API calls. However, you could create a credential that includes several APIs and specify different access levels for each.

If you already have a credential for the Diagnostic Tools API, then add the credential to the .edgerc file. Otherwise, continue with these instructions to create an API client and a credential.

  1. Launch Identity and Access Management. In Akamai Control Center, click ⇒ ACCOUNT ADMIN ⇒ Identity & access.

  2. From the Users and API Clients tab, click New API client for me to open the Customize API client screen.

  3. Click Quick to instantly create an API client and a credential for the Akamai APIs you can access. This client’s API access levels, group roles, and permissions are identical to yours. For details about roles and permissions and the level of access, see the Identity and Access Management documentation.

The client’s name, description, and notification list populate for you in the Details section. You can change this information at any time. The credential and your client token appear in the Credentials section. The credential includes the client token and client secret you need to authenticate Akamai API requests.

  1. To check you have access to the Diagnostic Tools API, under Details, click Show additional details, then scroll through the APIs for Diagnostic Tools. If the API isn’t listed, contact your account representative for assistance.

  2. Click Download, then add the credential to the .edgerc file.

Add credential to .edgerc file

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

  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 in the example. Then, within the syntax of your API calls, you can specify which section of the .edgerc file contains the related credential like this: http --auth-type edgegrid -a <section_name>: :/<api_endpoint>.

  3. Save the file in your home directory with the name .edgerc then make API calls with the Diagnostic Toos API.

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).

    NOTE: Dig (domain information groper) is a command-line tool for querying Domain Name System (DNS) servers.

    $ 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.

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

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.