How To

API Quickies – The API and Windows

This post might also be called, “How to Install Cygwin for Use With Open Hosting’s API…” Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. And, it is the easiest path to our API from a Windows machine. A correctly installed and configured Cygwin will allow you to exercise the entire API library just as easily from Windows as from Linux or OSX. There are three parts to this tutorial: installing Cygwin, installing the API scripts, and configuring a Cygwin session to connect with the API.

Installing Cygwin
  • Visit and download setup.exe.
  • Next, run setup.exe. With one exception, you should stick with the defaults throughout the entire installation. But, when you get to the “Select Packages,” type “curl” into the search box, and be sure to select cURL for installation. Click “default” once and it should read “install.”

Then click “next” and accept all the defaults until it starts installing.

  • Finally, if Windows bothers to ask if Cygwin was installed correctly, please insist it was indeed.

Cygwin and cURL are now installed. Next, we’ll download the API scripts and make them executable.

Installing the Open Hosting API Scripts

Similar to an OS, Cygwin has its own users and directories. On my Windows system, my Cygwin home directory is: C:/cygwin/home/Demo “Demo” is my user name. Into this folder, you’ll want to download the three Open Hosting API scripts:

Now, start Cygwin and confirm that the scripts are located in your home directory by typing ls.

Make the scripts executable by typing:

chmod +x

chmod +x

chmod +x

You’re now ready to interact with the Open Hosting API.

Configuring a Cygwin Session to Connect with the API

In order to interact with the platform by the API, two session variables need be set. The first is the API’s URI:

export OHURI=

(don’t forget the trailing slash!)

The second variable holds your authentication credentials, which are specific to your account and found on your account profile page:

export OHAUTH=[user UUID]:[secret API key]

(don’t forget the colon between the UUID and API values!)

For example:

export OHAUTH=d2d23ab0-4b3f-4b73-858a-4d2c9c2262c4:cdAcHx6aKTwtZqMSxQAjFbtTSxxxxxxxxxxxxxxx

For the duration of your Cygwin session, all of the Open Hosting API commands are available.

For example, ask the API to list all your account’s drives:

./ drives info