HTTPie
HTTPie is a simple command-line client you can use to make Akamai API calls.
Akamai Docker Development Environment
We've bundled several tools together, including
HTTPie, to make it easier for you to start testing Akamai APIs. Check out the Docker section for more information.
If you prefer to use HTTPie standalone, follow these steps.
Install HTTPie
To simplify the install process, you can use pip. It works on Linux, macOS, and Windows, and always provides the latest version of HTTPie. pip is already installed on Python v3.6 or later. You can download the latest version from python.org.
-
Run the command for your operating system to verify that
pipis installed:- Linux or macOS
python[python3] -m pip --version pip X.Y.Z from .../site-packages/pip (python X.Y)- Windows
C:\> py -m pip --version pip X.Y.Z from ...\site-packages\pip (python X.Y) -
Run the command for your operating system to install HTTPie and upgrade it to the most recent version:
- Linux or macOS
python -m pip install --upgrade httpie - Windows
C:\> py -m pip install --upgrade httpie
- Linux or macOS
-
Run this command to install the
httpie-edgegridplugin.
This is necessary to authenticate API calls. It's already included in thepiprepo, so you can quickly install it.pip install httpie-edgegrid -
Run this command to verify the installation and check the version:
pip show httpie-edgegrid
Authenticate
If you haven't already, you'll need to Create authentication credentials.
The httpie-edgegrid plugin relies on an .edgerc file to authenticate requests. If you need help setting up your .edgerc file, refer to Add credential to .edgerc file.
Make API calls with HTTPie
Once you've set up EdgeGrid authentication, you can make API calls with HTTPie.
HTTPie follows a generic path to authenticate and make requests to Akamai APIs:
http --auth-type=edgegrid -a default: :{akamai_api-endpoint}
-
auth-type=edgegrid. Tells the request to useedgegridfor authentication. -
-a default. Tells the request to reference the[default]section of your.edgercfile for credentials. -
{akamai-api-endpoint}. This endpoint corresponds to the specific API operation you want to call. You can find a list and explanation of available endpoints in the API documentation.
In this exercise, you'll use HTTPie to look up an IP address with the Edge Diagnostics API.
-
Request the locations of servers in the Akamai network that can run the diagnostic tools.
http --auth-type=edgegrid -a default: :/edge-diagnostics/v1/edge-locationsThe
200 OKresponse shows the location results:HTTP/1.1 200 OK Connection: keep-alive Content-Encoding: gzip Content-Length: 1991 Content-Type: application/json Date: Wed, 11 Jun 2025 15:57:59 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: nginx Vary: Accept-Encoding, Origin, Access-Control-Request-Method, Access-Control-Request-Headers X-RateLimit-Limit: 20 X-RateLimit-Remaining: 19 x-content-type-options: nosniff x-frame-options: DENY x-ids-session-id: a123456b-789-0123c-d456ef789ghi x-trace-id: a123456b789b0 x-xss-protection: 0 { "edgeLocations": [ { "id": "buenosaires-argentina", "value": "Buenosaires, Argentina" }, { "id": "adelaide-sa-australia", "value": "Adelaide, SA, Australia" }, { "id": "brisbane-qld-australia", "value": "Brisbane, QLD, Australia" }, { "id": "perth-wa-australia", "value": "Perth, WA, Australia" } ] } -
Request IP address information for Perth, WA, Australia, using the specific
idfrom the previous call,perth-wa-australia.http --auth-type=edgegrid -a default: POST :/edge-diagnostics/v1/dig \ edgeLocationId=perth-wa-australia \ hostname=example.com \ isGtmHostname=true \ queryType=AThe
200 OKresponse shows location-specific results:HTTP/1.1 200 OK Connection: keep-alive Content-Encoding: gzip Content-Length: 727 Content-Type: application/json Date: Wed, 11 Jun 2025 15:35:15 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: nginx Vary: Accept-Encoding, Origin, Access-Control-Request-Method, Access-Control-Request-Headers X-RateLimit-Limit: 40 X-RateLimit-Remaining: 39 x-content-type-options: nosniff x-frame-options: DENY x-ids-session-id: a123456b-789-0123c-d456ef789ghi x-trace-id: a123456b789b0 x-xss-protection: 0 { "completedTime": "2025-06-11T15:36:44Z", "createdBy": "jsmith", "createdTime": "2025-06-11T15:36:43Z", "edgeIpLocation": { "asNumber": 20940, "city": "PERTH", "countryCode": "AU", "regionCode": "WA" }, "executionStatus": "SUCCESS", "internalIp": "12.345.67.890", "request": { "edgeLocationId": "perth-wa-australia", "hostname": "example.com", "isGtmHostname": true, "queryType": "A" }, "result": { "authoritySection": [ { "domain": "example.com.", "preferenceValue": null, "recordClass": "IN", "recordType": "SOA", "ttl": 30, "value": "a.example.net." } ], "result": "\n; <<>> DiG 1.23.45-0ubuntu6.78.90.1aka23.4.5-Ubuntu <<>> example.com -t A\n;; global options: +cmd\n;; Got answer:\n;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 1234\n;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1\n\n;; OPT PSEUDOSECTION:\n; EDNS: version: 0, flags:; udp: 512\n;; QUESTION SECTION:\n;example.com. IN\tA\n\n;; AUTHORITY SECTION:\nnet.\t\t\t30\tIN\tSOA\tta.example.net. nstld.example.com. 1234567890 1234 567 890123 456\n\n;; Query time: 214 msec\n;; SERVER: 123.4.5.6#78(123.4.5.6) (UDP)\n;; WHEN: Wed Jun 11 15:36:44 UTC 2025\n;; MSG SIZE rcvd: 137" } }
If you want more details on using HTTPie with EdgeGrid, see our httpie-edgegrid repo.
Updated 4 months ago
