A bash client for OVH API
 
 
Go to file
Didier BONNEFOI 143ad5114b Allow to set --profile option at any position :
- functions to create keys now launched out of parseArguments()

bugfix :
- fix empty CURRENT_PATH when launching --init/--initApp

enhancements :
- better output for --list-profile output + add 'default' profile

refactoring :
- move initApplication() into createConsumerKey() instead of calling it each time
2017-06-21 00:21:47 +02:00
.gitignore Allow multiple API keys management with profiles 2017-06-13 18:06:41 +02:00
Makefile first commit 2014-04-17 19:53:28 +02:00
README.md if --profile is set to 'default', load configuration from script directory 2017-06-19 18:36:33 +02:00
ovh-api-bash-client.sh Allow to set --profile option at any position : 2017-06-21 00:21:47 +02:00

README.md

ovh API Bash client

A bash client for OVH API (https://api.ovh.com/)

Initialize

Retrieve dependency

First in order to retrieve needed dependency, run:

    make

Create an OVH API Application

In order to create a new OVH API application, run:

    ./ovh-api-bash-client.sh --initApp

Create a Consumer Key

In order to create a new consumer key, run:

    ./ovh-api-bash-client.sh --init

Options

Show help

    ./ovh-api-bash-client.sh --help

Possible arguments are:

  --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 <CA|EU>        : the target API (default is EU)
  --init                  : to initialize the consumer key
  --initApp               : to initialize the API application
  --list-profile          : list available profiles in profile/ directory
  --profile <value>
            * default : from script directory
            * <dir>   : from profile/<dir> directory

Usage

Just some examples:

To make a basic call on GET /me just run:

    ./ovh-api-bash-client.sh

To retrieve your domain list, run:

    ./ovh-api-bash-client.sh --url "/domain"

To activate the monitoring on your dedicated server, run:

    ./ovh-api-bash-client.sh --method PUT --url "/dedicated/server/ns00000.ovh.net" --data '{"monitoring": true}'

create a Consumer key for different account or usage

    mkdir profile/demo1
    mkdir profile/demo2
    ./ovh-api-bash-client.sh --profile demo1 --init
    ./ovh-api-bash-client.sh --profile demo2 --init