Meteor.http.post seems to be working incorrectly

I am trying to publish a user feed from the server side of the Meteor application in the facebook feed:

result = Meteor.http.call 'POST', "https://graph.facebook.com/#{facebook_id}/feed?access_token=#{app_access_token}", { data: { message: "some message", link: "http://www.somelink.com" } } 

As a result, I got the following:

 {"statusCode":400,"content":"{\"error\":{\"message\":\"(#100) Missing message or attachment\",\"type\":\"OAuthException\",\"code\":100}}","headers":{"access-control-allow-origin":"*","cache-control":"no-store","content-type":"text/javascript; charset=UTF-8","expires":"Sat, 01 Jan 2000 00:00:00 GMT","pragma":"no-cache","www-authenticate":"OAuth \"Facebook Platform\" \"invalid_request\" \"(#100) Missing message or attachment\"","x-fb-rev":"710505","x-fb-debug":"doa24fNWaPsogxv4HmXa1/5KA30BBct86VZWVeYsins=","date":"Fri, 11 Jan 2013 13:57:52 GMT","connection":"keep-alive","content-length":"95"},"data":{"error":{"message":"(#100) Missing message or attachment","type":"OAuthException","code":100}},"error":{}} 

I tried to reproduce this problem in the Facebook debugger - I received the same message only if I did not send any parameters to the POST body. Could this be the problem of implementing POST in Meteor.http.call?

+4
source share
1 answer

You send your data to the body of the contents of the HTTP POST data request, you need to use params to pass the correct variables as postdata p>

to try

 result = Meteor.http.post( "https://graph.facebook.com/#{facebook_id}/feed?access_token=#{app_access_token}", { params: { message: "some message", link: "http://www.somelink.com" } } ); 

Also, if you use diong in the Meteor.methods stub, try using this.unblock(); so that other operations can be performed at the same time.

Update : newer versions of using the HTTP meteor instead of Meteor.http , the code above will look like HTTP.post as a replacement.

+10
source

All Articles