Quantcast
Channel: DreamFactory Forum - Latest topics
Viewing all articles
Browse latest Browse all 1523

What's wrong with my server side Node Script

$
0
0

@jeebee wrote:

hi all
i've setup a service (custom scripting service) that do some operation on my mongodb

I want to run this script on a daily basis

so i need to cron a script that will do a POST operation to this Service
but to do a POST i need a Session Token

I've setup a nodejs script that will POST a user session in order to get a session token (and after when it will work to a Post to my scripting service)
so,
here is my node js script

var request = require("request");

var options = {
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url : 'http://Myip/api/v2/user/session',
method: 'POST',
data : JSON.stringify({
'email': 'email@email.com,
'password': 'mypassword'
}),
};

request(options, function (error, response, body) {
if(error) {

            console.log(error);
        } else {
            console.log(response.statusCode, body);
        }

});

but i get an error like

400 '{"error":{"context":null,"message":"Login request is missing required email.","code":400,"trace"

any idea on what's wrong with my script
any other way to POST to my custom scripting service ?

thanks

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 1523

Trending Articles