I am using unirest npm to access an API. Here is the code I am trying, but it gives an error "Syntax error: unexpected token : at .header('content-type': 'application/json')"
var unirest = require('unirest');
unirest.get('https://URL/index.php?/api/V2/get_case/2')
.header('content-type': 'application/json')
.auth({user:'a@b.com',
pass:'password',
sendImmediately:true
})
.end(function(response){
console.log(response.body);
});
can you suggest a fix for this? thanks in advance.
Aucun commentaire:
Enregistrer un commentaire