Developers' Guide
This guide introduces our REST API, which allows developers to interact with Database Labs programmatically. You can use the API to list, create, and destroy databases; check database statuses, and check metadata such as what datacenter regions are currently available.
This guide walks you through the basics of connecting to the API and should take about 10 minutes to work through. After that, move on to the API Reference to learn what API calls are available.
Command line usage with HTTPie
We recommend the HTTPie command line client for testing API access, as it has an intuitive user interface and built-in JSON decoding. Other standard HTTP clients such as curl will also work fine. Examples in this guide use HTTPie.
Authentication and Security
Every API call is encrypted. Calls are made via HTTPS to a URL starting
with https://www.databaselabs.io/api/
.
All API calls must be authenticated with an API key and an API secret. Obtain API credentials for your account by logging in and clicking the API Keys link.
The API key and secret are sent to the server as the login and
password of the HTTP
Basic authentication scheme. This scheme is built in to all
popular REST libraries and clients. With HTTPie, it's activated
by using the -a
command line option. For example:
To test your API key and secret, do:
http -a $MY_API_KEY:$MY_API_SECRET https://www.databaselabs.io/api/ping
Replace $MY_API_KEY
with your API key, and
$MY_API_SECRET
with your API secret. If you get a "Pong" from the server as the response, your
API call worked. If not, check your credentials and try again — uppercase and lowercase count!
For example:
% http -a $MY_API_KEY:$MY_API_SECRET https://www.databaselabs.io/api/ping HTTP/1.1 200 OK Content-Length: 4 Content-Type: text/plain;charset=UTF-8 Date: Tue, 19 Aug 2014 04:31:48 GMT Server: http-kit Vary: Accept Pong
Available API Calls
The complete list of available API calls is documented in the API reference.
Need help?
Need help getting started with the API? Write us at support@databaselabs.io and a real human will get back to you.