yun549
15/03/2016, 12h34
Bonjour, je n'arrive pas à effectuer des requêtes correctes à l'API de Kimsufi.
Mon code est le suivant.
Je reçois invariablement un status code 400, sans message ni body attaché.
Le premier console.log donne le résultat suivant : "MONAS"+"MACK"+GET+https://eu.api.kimsufi.com/1.0/dedic...oad+1458040197
Le second le résultat suivant :
{ host: 'eu.api.kimsufi.com',
port: 443,
path: '/1.0/dedicated/server/ns328454.ip-37-187-114.eu/statistics/load',
headers:
{ Accept: 'application / json',
'X-Ovh-Application': 'MON-APPLICATION-KEY',
'X-Ovh-Consumer': 'MA-CONSUMER-KEY',
'X-Ovh-Signature': '$1$502817feae5b59518e4b98b77c6039252809bbaf',
'X-Ovh-Timestamp': 1458040197 } }
La réponse :
En vous remerciant par avance pour votre aide
Mon code est le suivant.
Je reçois invariablement un status code 400, sans message ni body attaché.
Code:
var nows = ~~(new Date().getTime() / 1000); var options = { host: config.kimsufi.host, port: 443, path: '/1.0/dedicated/server/' + _serviceName + '/statistics/load', headers: { "Accept": 'application / json', 'X-Ovh-Application': config.kimsufi.application, 'X-Ovh-Consumer': config.kimsufi.consumer, 'X-Ovh-Signature': '$1$' + sha1(config.kimsufi.secret + "+" + config.kimsufi.consumer + "+GET" + "+https://" + config.kimsufi.host + "/1.0/dedicated/server/" + _serviceName + "/statistics/load+" + nows), 'X-Ovh-Timestamp': nows } }; http.get(options, function(response) { console.log("Got response: " + response.statusCode); return res.send(200, response.body); }).on('error', function(e) { console.log("Got error: " + e.message); });
Le second le résultat suivant :
{ host: 'eu.api.kimsufi.com',
port: 443,
path: '/1.0/dedicated/server/ns328454.ip-37-187-114.eu/statistics/load',
headers:
{ Accept: 'application / json',
'X-Ovh-Application': 'MON-APPLICATION-KEY',
'X-Ovh-Consumer': 'MA-CONSUMER-KEY',
'X-Ovh-Signature': '$1$502817feae5b59518e4b98b77c6039252809bbaf',
'X-Ovh-Timestamp': 1458040197 } }
La réponse :
Code HTML:
Got response: 400