Tech insights and news. Best served hot.

2016

November
3

Workflow Automation With Our New API

Many projects quickly grow into a set of several virtual servers: e.g. to separate "development", "staging" and "production" environments, to test new releases of a certain software or by deploying additional servers to handle load peaks. Thanks to our new API you can now include the deployment of new servers in your configuration management tool or task-specific scripts and thereby simplify and speed up your workflow.

Get ready in just one step

All it takes to use our new API is an API token: A secret string that you need to include in all your calls to our API.

You can create as many tokens as you need in your account settings of our cloud control panel. For reporting-only purposes, creating a "read access" token is a safe choice. If you intend to also make changes through the API (e.g. create or reboot a server), enable "write access" as well.

Make sure to choose a meaningful name so you can tell your tokens apart. This will help you to identify a token in case you need to revoke it later. Please note that we only keep a hashed copy of your tokens in our database. Therefore they cannot be displayed again later on.

How to use our API

Our API is an HTTPS API following the REST paradigm, and therefore compatible with virtually everything you might be working with. As a basic example, you can display a list of your current servers right from your local command line by using:

curl -H 'Authorization: Bearer PasteYourCloudscaleApiTokenHere' https://api.cloudscale.ch/v1/servers

Any required parameters can be supplied in either JSON- or URL-encoded form. The API returns information in JSON format for easy parsing and further processing. All available functions are documented at https://www.cloudscale.ch/en/api, complete with the correct HTTP method, parameters as well as an example.

Some use cases and hints

The potential use cases enabled by our API are endless: If your coworkers need to set up predefined infrastructures repeatedly, you can now provide them with a script that makes use of our API and the cloud-config feature. Or you might want to automate information retrieval – for your project members, for documentation or a real-time dashboard.

Be aware that all API calls are executed without further confirmation so you can reliably use them in an automated fashion. Since your API tokens can be compared to a password, be careful about where you store them (e.g. public repositories) and who can access them (e.g. script location or bash history), and revoke them quickly if necessary.

When deleting a server, you will now get a pro rata refund for the remainder of our 24-hour billing period. Feel free to test different setups and features, and replace older servers with a fresh installation at no extra cost. If you are using additional, short-lived servers to cover periodical load peaks, this change will obviously benefit you too.

 

While we keep working on our easy-to-use cloud control panel for humans, we are happy to announce that cloudscale.ch is now equally easy to use for computers.

Happy automating!
Your cloudscale.ch team

 

PS: As an announcement to our fellow Python users: We are working on being included in an upcoming Libcloud release to further facilitate using our API. Stay tuned!

The latest news. Best served hot.

Try it yourself and launch a Swiss Linux server today!