How to talk with external nosql with service custom script


#1

I tried to use node custom script tutorial as a guide to test external nosql api that I setup in the service, but I gotten the following error

error": {
“context”: null,
“message”: “Bad request. No token or api key provided.”,
“code”: 400,
“trace”: [

The code is as follows…
taken from and modify from -> http://wiki.dreamfactory.com/DreamFactory/Tutorials/Node_API_example

var request = require(‘request’);

var options = {
// Get all records from todo table.
// This table can be easily created in admin console from Schema–>Upload JSON.
url: ‘http://xyz008.com/api/v2/db/_table/ext_nosql’,
// Use same auth as user calling this script.
headers: {
‘x-dreamfactory-api-key’: ‘2190dsfa0vf23r9203vjwerwer23r’
}
};

request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
event.response.content = body;
} else {
event.response.status_code = response.statusCode;
event.response.content = body;
}
});