开发者

Facebook API: How to update the status?

开发者 https://www.devze.com 2023-01-21 11:48 出处:网络
How can 开发者_JS百科I update my facebook tatus messages through the API? There are a lot of examples around the net but all of they seem to be deprecated with the New Facebook API.

How can 开发者_JS百科I update my facebook tatus messages through the API?

There are a lot of examples around the net but all of they seem to be deprecated with the New Facebook API.

Regards!


A status message is now just a post. So you using the Graph API to publish a post to the user. You basically just need to do an HTTP POST to http://graph.facebook.com/PROFILE_ID/feed. The POST body should contain the value for the message. If you want the status to change you must only set the message. Here is how you would do it with curl.

curl -F 'access_token=...' \
 -F 'message=Check out this funny article' \
 https://graph.facebook.com/me/feed

You can find more information about this here: http://developers.facebook.com/docs/reference/api/post


Using javascript graph api sdk also it is possible

    FB.api('/me/feed', 'post', { message: body }, function(response) {
    if (!response || response.error) {
    alert("error");
    } else {
     alert("Status posted");
    }


//Get the access token and secret.and check if true than write below code in your condition

url = "https://graph.facebook.com/me/feed?access_token=" + oAuth.Token;

json = oAuth.WebRequest(oAuthFacebook.Method.POST, url, "message=" + msg);
0

精彩评论

暂无评论...
验证码 换一张
取 消