2017-06-21 14:47:55 +02:00
|
|
|
OVH API Bash client
|
2014-04-17 20:13:09 +02:00
|
|
|
================
|
|
|
|
|
|
|
|
A bash client for OVH API (https://api.ovh.com/)
|
|
|
|
|
|
|
|
Initialize
|
|
|
|
----------
|
|
|
|
|
2014-04-17 22:17:09 +02:00
|
|
|
### Retrieve dependency
|
|
|
|
|
2014-04-17 22:17:44 +02:00
|
|
|
First in order to retrieve needed dependency, run:
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2014-04-17 22:17:09 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
make
|
2014-04-17 22:17:09 +02:00
|
|
|
```
|
|
|
|
|
2014-04-17 21:31:01 +02:00
|
|
|
### Create an OVH API Application
|
|
|
|
|
2014-04-17 21:28:03 +02:00
|
|
|
In order to create a new OVH API application, run:
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2014-04-17 20:16:30 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh --initApp
|
2014-04-17 20:16:30 +02:00
|
|
|
```
|
2014-04-17 20:13:09 +02:00
|
|
|
|
2014-04-17 21:31:01 +02:00
|
|
|
### Create a Consumer Key
|
|
|
|
|
|
|
|
In order to create a new consumer key, run:
|
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh --init
|
2014-04-17 21:31:01 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Options
|
|
|
|
-------
|
|
|
|
|
2017-06-13 18:06:41 +02:00
|
|
|
### Show help
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2017-06-13 18:06:41 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh --help
|
2017-06-13 18:06:41 +02:00
|
|
|
```
|
|
|
|
|
2014-04-17 21:31:01 +02:00
|
|
|
Possible arguments are:
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2014-04-17 21:31:01 +02:00
|
|
|
```
|
2017-06-19 18:36:33 +02:00
|
|
|
--url <url> : the API URL to call, for example /domains (default is /me)
|
|
|
|
--method <method> : the HTTP method to use, for example POST (default is GET)
|
|
|
|
--data <JSON data> : the data body to send with the request
|
2018-08-26 13:08:27 +02:00
|
|
|
--target <target> : the target API [CA|EU|US] (default is EU)
|
2018-02-20 17:12:34 +01:00
|
|
|
--init : to initialize the consumer key, and manage custom access rules file
|
2017-06-19 18:36:33 +02:00
|
|
|
--initApp : to initialize the API application
|
2018-02-20 17:12:34 +01:00
|
|
|
--list-profile : list available profiles in ~/.ovh-api-bash-client/profile directory
|
2018-08-26 13:08:27 +02:00
|
|
|
--profile <profile>
|
2018-02-20 17:12:34 +01:00
|
|
|
* default : from ~/.ovh-api-bash-client/profile directory
|
|
|
|
* <dir> : from ~/.ovh-api-bash-client/profile/<dir> directory
|
2014-04-17 21:31:01 +02:00
|
|
|
```
|
|
|
|
|
2014-04-17 20:13:09 +02:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2014-04-17 21:31:01 +02:00
|
|
|
### Just some examples:
|
|
|
|
|
2018-08-26 13:08:27 +02:00
|
|
|
To make a basic call on GET `/me` just run:
|
|
|
|
|
2014-04-17 20:16:30 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh
|
2014-04-17 20:16:30 +02:00
|
|
|
```
|
2014-04-17 20:13:09 +02:00
|
|
|
|
2014-04-17 21:28:03 +02:00
|
|
|
To retrieve your domain list, run:
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2014-04-17 21:28:03 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh --url "/domain"
|
2014-04-17 21:28:03 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
To activate the monitoring on your dedicated server, run:
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2014-04-17 21:28:03 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh --method PUT --url "/dedicated/server/ns00000.ovh.net" --data '{"monitoring": true}'
|
2014-04-17 21:28:03 +02:00
|
|
|
```
|
|
|
|
|
2017-06-21 14:31:13 +02:00
|
|
|
To create a Consumer key for different account or usage (profile is created if missing)
|
2018-08-26 13:08:27 +02:00
|
|
|
|
2017-06-13 18:06:41 +02:00
|
|
|
```
|
2018-08-26 13:08:27 +02:00
|
|
|
./ovh-api-bash-client.sh --profile demo1 --init
|
|
|
|
./ovh-api-bash-client.sh --profile demo2 --init
|
2017-06-13 18:06:41 +02:00
|
|
|
```
|
2017-06-30 18:57:05 +02:00
|
|
|
|
|
|
|
Embedded lib for external scripts
|
2017-07-14 01:09:28 +02:00
|
|
|
---------------------------------
|
2017-06-30 18:57:05 +02:00
|
|
|
|
2017-07-14 01:09:28 +02:00
|
|
|
See **contrib/** directory
|