Start with OVH API

Hello,

First ticket for a while and it's about ovh's api, which made me crazy for several hours.
The new ovh api is accessible here : API Ovh
It's a new RESTful api with good stuff but very poor documentation.

How to start with

What we need to work with OVH Api :

  • A valid Application Key
  • A valid Consumer Key
  • A secret Key

How to obtain your application Key AND your secret Key

You just need to complete with true information this form.
You will get your application Key and your secret key.

if you get an error, try to add -ovh to your Nic

How to obtain your Consumer Key

Your application is not yet available, you need to validate it...

You can do it with a simple curl :

curl --header "X-Ovh-Application:YOURAPPKEY" --data '{"accessRules":[{"method":"GET","path":"/*"},{"method":"POST","path":"/*"},{"method":"PUT","path":"/*"},{"method":"DELETE","path":"/*"}]}' https://api.ovh.com/1.0/auth/credential  

Or with

npm install ovh  

create a file : credential.js

var ovh = require('ovh');

var rest = ovh({  
  auth: {type: 'REST', path: '/auth'}
}, {
  appKey: 'YourAppKey',
  appSecret: 'YourAppSecret'
});

rest.auth.call('POST', '/auth/credential', {  
  'accessRules': [
     {'method': 'GET', 'path': '/*'},
     {'method': 'POST', 'path': '/*'},
     {'method': 'PUT', 'path': '/*'},
     {'method': 'DELETE', 'path': '/*'}
   ]
}, function (success, credential) {
  console.log(credential);
});
node --harmony-proxies credential.js  

Now you have all stuff to work with ovh api.

comments powered by Disqus