Post Request to Parse Mobile data management

Problem

I'm trying to send a post request to Parse: https://parse.com/docs/rest#objects-creating. Can't get it to work correctly. I use the real the App and Rest API ID's in my program.

var https = require('https');

var options = {
 host: 'api.parse.com',
 port: 443,
 path: '/1/classes/GameScore',
 method: 'POST',
 headers: {
    X-Parse-Application-Id: "",
    X-Parse-REST-API-Key: "",
    Content-Type: "application/json";
}
 data: {
    "score": 1337, "playerName": "Sean Plott", "cheatMode": false
 }
}

};

var req = https.request(options, function(res) {
 console.log("statusCode: ", res.statusCode);
 console.log("headers: ", res.headers);

res.on('data', function(d) {
 process.stdout.write(d);
 });
});
req.end();

req.on('error', function(e) {
 console.error(e);
});

EDITED: Added error response:

SyntaxError: Unexpected token -
at Module._compile (module.js:406:25)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at Array.<anonymous> (module.js:430:10)
at EventEmitter._tickCallback (node.js:126:26)
Problem courtesy of: mnort9

Solution

You cannot use - as a key to the object without quotes.

So you need to change

headers: {
  X-Parse-Application-Id: "",
  X-Parse-REST-API-Key: "",
  Content-Type: "application/json";
}

to be

headers: {
  "X-Parse-Application-Id": "",
  "X-Parse-REST-API-Key": "",
  "Content-Type": "application/json";
}
Solution courtesy of: staackuser2

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.