ovh-api-bash-client/README.md

90 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

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:
2014-04-17 22:17:09 +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:
2014-04-17 20:16:30 +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:
```
./ovh-api-bash-client.sh --init
2014-04-17 21:31:01 +02:00
```
Options
-------
### Show help
```
./ovh-api-bash-client.sh --help
```
2014-04-17 21:31:01 +02:00
Possible arguments are:
2014-04-17 21:31:01 +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
--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
--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
--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:
To make a basic call on GET `/me` just run:
2014-04-17 20:16:30 +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:
2014-04-17 21:28:03 +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:
2014-04-17 21:28:03 +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
```
To create a Consumer key for different account or usage (profile is created if missing)
```
./ovh-api-bash-client.sh --profile demo1 --init
./ovh-api-bash-client.sh --profile demo2 --init
```
Embedded lib for external scripts
---------------------------------
See **contrib/** directory