The APIs available on https://api.us.ovhcloud.com/ allow you to purchase, manage, update, and configure OVHcloud products without using a graphical interface such as the Control Panel.
Learn how to use OVHcloud APIs and how to pair them with your applications.
You have an active OVHcloud account and know its credentials.
You are on the OVHcloud API web page.
Sign in to OVHcloud APIs
On the OVHcloud API page, click
Explore the OVHcloud API to view the list of APIs.
To use the APIs on your products, you must sign in to this site using your OVHcloud credentials.
Loginin the upper right.
- Enter your OVHcloud credentials and click
- Set the validity time for the login, then click
Explore available products on APIs
Once logged in, you will see a list of OVHcloud products that can be managed with APIs. This list is sorted alphabetically.
For example, to view the Public Cloud APIs, click /cloud in the list.
After you click the product, a list of the product’s APIs appears below. There is also a Filter feature to limit the visible API calls.
There are four types of APIs available that use what are called HTTP methods:
The GET method is used to retrieve data from a resource.
For example, to retrieve a list of your instances, use the following API:
The POST method is used to send additional data to the resource.
For example, to create a new instance, use the following API:
The PUT method is used to replace the current data in the resource with the data in the query.
For example, to alter an instance in your project, use the following API:
The DELETE method is used to delete the called resource.
For example, to delete an instance from your project, use the following API:
After you click the API you want, the Parameters section allows you to assign variables for its application.
For example, when retrieving a list of instances in a project you must enter the serviceName and can also add information in the region variable.
Once you have set the parameters, you can launch the API by clicking
Result tab displayed will give you the API execution report.
Python tabs contain the elements to be added to your script according to the language used.
Advanced usage: pair OVHcloud APIs with an application
Create your app keys
Any application that wants to communicate with the OVHcloud API must be declared in advance.
To do this, click the following link: https://us.ovhcloud.com/auth/api/createToken.
Fill in your OVHcloud customer ID, password, and application name. The name will be useful later if you want to allow others to use it.
You can also add a description of the application and a validity period.
Rights field allows you to restrict the use of the application to certain APIs.
To allow all OVHcloud APIs for an HTTP method, put an asterisk (
*) into the field, as in the following example where the GET method is allowed for all APIs:
After you click
Create keys, you will be issued three keys:
- the application key, called AK. For example:
- your secret application key, not to be disclosed, is called AS. For example:
- a secret “consumer key“, not to be disclosed, called CK. For example:
In this case, the CK key is attached to your account.
The CK token can be used for rights delegation.
First API Usage
Once you have obtained your three keys (AK, AS, CK), you can sign API requests. The signature is calculated as follows:
"$1$" + SHA1_HEX(AS+"+"+CK+"+"+METHOD+"+"+QUERY+"+"+BODY+"+"+TSTAMP)
To simplify the development of your applications, OVHcloud provides API wrappers in multiple languages. Using them will help you avoid worrying about signing requests so that you can focus on developing your application.
- Perl : https://api.us.ovhcloud.com/wrappers/OvhApi-perl-1.1.zip
- Python : https://github.com/ovh/python-ovh
- PHP : https://github.com/ovh/php-ovh
- Node.js : https://github.com/ovh/node-ovh
- Swift : https://github.com/ovh/swift-ovh
- C# : https://github.com/ovh/csharp-ovh
Here is an example of how to use the
/me section to manage your OVHcloud account:
import ovh # Instantiate. Visit https://ca.api.ovh.com/createToken/?GET=/me # to get your credentials client = ovh.Client( endpoint='ovh-us', application_key='<application key>', application_secret='<application secret>', consumer_key='<consumer key>', ) # Print nice welcome message print("Welcome", client.get('/me')['firstname'])