DreamCLI (DreamHost API CLI Wrapper)


This script was made as a wrapper to the DreamHost API, so that it can easily be used on the command line, or by other scripts.

Oh, and the DreamHost API contest


Because web scripting can be annoying. Especially for those of us who are used to BASH or other types of scripting. Or, maybe we just perfer the command line?

How it works

Simple, it takes all the options you set in the confuration, and all your command line options, and it sends them over to dreamhost. The result is printed (tab format). The error code is returned as an error code, like CLI programs usually do, and any extra error information is printed to STDERR, so that it doesn't get in the way of a script thats trying to use the command output.

Some of the features to help your scripting/use:
  • If you forget the dreamhost commands, simply omit --cmd, and you will be given your accessable commands
  • You can specify --noheader, so that the column names get stripped out
  • You can specify --cols col1,col2,colN... to print out only the columns you want, in the order you want
Examples? Sure.
  • ./dreamcli.pl --help
  • ./dreamcli.pl --cmd domain-list_domains --cols domain --noheaders #prints out all your domain names
  • ./dreamcli.pl --cmd domain-list_domains #prints out everything
  • ./dreamcli.pl --cmd announcement_list-list_subscribers --listname list1 --domain joshlange.net --cols email,name
Can I change things? Of course...
  • ./dreamcli.pl --cmd dns-add_record --record mycomputer.mydomain.com --type A --value

Supported Platforms

I personally use several different platforms, and I know how imporant it is to support them all. Any platform that supports perl is supported by this script.

Getting Started

The easiest way to get started with DreamCLI is to download it, and run it on the command line.
  • Install perl from your operating system's package manager, if you don't already have perl
  • If you are using windows, install ActivePerl for Windows
  • If you get a "bad interperter" error, put the correct path to perl on line 1 of the script


The setup is very straight forward.
  1. Install perl
    • You probably already have it.
    • On Windows, install ActivePerl
  2. Generate an API key
    • Make sure that anything you want is checked
    • Uncheck everything else
  3. Edit configuration (so you don't need to give cli arguements, optional)
    • In a text editor, put your api key, username, and domain into the script where indicated.
  4. Test out the script


Without any license research I quickly wrote my own, I call it the Josh Public License

Contest specifics

I saw another submission had this, so I am adding it.
  • Submitted: May 3rd, 2009
  • Application Name: DreamCLI Wrapper
  • API Functions Used: all
  • Download

    05-04-09 v0.2 is now available
    • You can now specify to only print certain columns with --cols
    • --nocols option renamed to --noheaders

    view on github    (direct download)