Akamai HTTPie

Setting Up HTTPie for Akamai

February 16, 2017 · by Javier Garza

If you're a Web Developer or DevOps, you probably have to deal with several API systems daily. HTTPie allows you to easily explore APIs before you decide if it's worth to spend the effort to code a client using one of the programming languages like Python, Ruby, Go, etc.

This blog is going to explain a few tips you can use to improve the experience of using HTTPie with Akamai systems.

Get Started with HTTPie and Akamai

First, if you're not already using HTTPie with Akamai, see this excellent post for instructions: Exploring Akamai OPEN APIs from the command line using HTTPie and jq.

Once you're up and running, open the HTTPie configuration file located at ~/.httpie/config.json (or %APPDATA%\httpie\config.json on Windows).

NOTE: The config directory location can be changed by setting the HTTPIE_CONFIG_DIR environment variable. To view the exact location run http --debug.

Edit the Configuration File

To make HTTPie work better with Akamai systems, edit the file to match the following:

{     "__meta__": {         "about": "HTTPie configuration file",         "help": "",         "httpie": "0.9.9"     },


    "default_options": [         "--verbose",         "--traceback",         "--auth-type=edgegrid",         "--print=Hhb",         "--timeout=300",         "--style=autumn",         "--session-read-only","~/.httpie-custom-headers.json",=         "-adefault:"     ] }


The lines in bold text are the default options you can configure. Here's what they do:

If you installed the httpie-edgegrid package using "git clone", you can put the parameter on the config file to have it indicated by default so instead of calls like:

http --auth-type=edgegrid :/diagnostic-tools/v1/locations

you can run:

http :/diagnostic-tools/v1/locations

By default HTTPie's timeout is 30 seconds. Unfortunately some API calls may take over 30s, so it is always good to have a higher timeout.
Allows adding the infamous Akamai debug headers to each HTTPie outgoing request. See Using Akamai Pragma headers to investigate or troubleshoot Akamai content delivery for more information about using the Pragma headers.


The file ~/.httpie-custom-headers.json will contain the following:

{ "headers": { "Pragma": "akamai-x-cache-on, akamai-x-get-cache-key, akamai-x-check-cacheable, akamai-x-get-true-cache-key, akamai-x-get-request-id, akamai-x-cache-remote-on"             } }

Tells HTTPie to use the default session when no session is present.