Now Shipping: MaxCLI > maxcurl
July 3, 2014 | Josh Mervine
I’ve been recently working on building out a Go package to interact with MaxCDN’s REST API. In the process, I started building a suite of command line tools for easily performing common account actions. This is the first in a multipart series on these MaxCLI tools, where I’ll be covering a tool I call
In developing tools against MaxCDN’s REST API, accessing the raw response data becomes very helpful in debugging.
maxcurl is modeled (loosely) after cURL command and as such tries to provide similar functionality, with the additional benefit of handling authentication behind the scenes.
$ maxcurl --version maxcurl version 1.0.0 $ maxcurl --help Usage: maxcurl [arguments...] PATH Example: $ maxcurl -a ALIAS -t TOKEN -s SECRET /account.json Options: --config, -c '~/.maxcdn.yml' yaml file containing all required args --alias, -a [required] consumer alias --token, -t [required] consumer token --secret, -s [required] consumer secret --method, -X 'GET' request method --host, -H override default API host --headers, -i show headers with body --pretty, --pp pretty print json output --verbose display verbose http transport information --version, -v print the version --help, -h show help 'alias', 'token' and/or 'secret' can be set via exporting them to your environment and ALIAS, TOKEN and/or SECRET. Additionally, they can be set in a YAML configuration via the config option. 'pretty' and 'host' can also be set via configuration, but not environment. Precedence is argument > environment > configuration. WARNING: Default configuration path works for *nix systems only and replies on the 'HOME' environment variable. For Windows, please supply a full path. Sample configuration: --- alias: YOUR_ALIAS token: YOUR_TOKEN secret: YOUR_SECRET pretty: true
The recommended and easiest method would be to download a prebuilt binary for your system.
For those interested, manual build and install instructions are available at github.com/MaxCDN/maxcli.