I am trying to post an apprequest to a user using the URL:
https://graph.facebook.com/USER_ID/apprequests?message=’This is a new message from the pgm’&data='t1t2t3t4’&access_token=ACCESS_TOKEN_RECEIVED_FROM_FB&method=post
I am getting the following error:
Response Message Bad Request Response Code 400 App Request ID: 400 Bad Request
Method Not Implemented Invalid method in request
Note: I got the access token and the same url works fine in the browser (Chrome).
Am I missing something? Couldn't find much in the documentation!
Regards
You need to url-encode your parameters. The browser does this transparently to you, that's why it's working there. Assuming you're using php:
http_build_query(array(
"message" => "This is a new message from the pgm",
"data" => "t1t2t3t4",
"access_token" => ACCESS_TOKEN_RECEIVED_FROM_FB,
"method" => "post"
));
This will take care of the encoding and joining parameters via amperstand characters. The return value is:
message=This+is+a+new+message+from+the+pgm&data=t1t2t3t4&access_token=ACCESS_TOKEN_RECEIVED_FROM_FB&method=post