Setting Up HTTPie for Akamai

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:

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:

you can run:
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:

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

Categories: Technology

Suggested Article