Im trying to get the google plus share count for a given url, i can make it work using jquery on the client side, but now im trying to do it on the server side using nodejs.
for example in jquery, i would use this:
$.ajax({
cache: false,
type: "POST",
url: "https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ",
data: [{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"http://www.test.com","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}],
dataType: "jsonp",
success: function (data) {
console.log(data);
},
error: function(data){
console.log(data);
}
})
I want to do the same thing using request module on nodejs:
request.post(
'https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ',
{ form: [{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"http://www.paulgraham.com","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}] },
function (error, response, body) {
console.log(response.statusCode)
if (!error && response.statusCode == 200) {
console.log(body)
}
}
);
I can't seem to figure it out. i get 415
error.