bertrando / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

graph api problem #169

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
Graph API 1.0

I have some problem with Facebook Flash graph API

I am receiving request, but realy when I check my wall in facebook 
FacebookDesktop.api not adds Like or unLike

please help me if anyone have experience in Flash Gaph API, and how to solve 
the problem (or this is the BUG!!!)

down is an example, what I am trying to do:

private function likeClickHandler(event:MouseEvent):void{

               handleLikeClick()
          }

          protected function populateLikeCount():void {
               if (intData.user_likes) {
                    likeBtn.label = 'Unlike';
               } else {
                    likeBtn.label = 'Like';
               }

               likesCount.text = intData.likes == null ? '':intData.likes + ' likes.';
               //likeBtn.visible = int(intData.likes > 0);
          }

          protected function handleLikeClick():void {
               loading.visible = true;
               if (intData.user_likes) {
                    FacebookDesktop.api('/'+intData.id+'/likes', handlePostUnliked);
               } else {
                    FacebookDesktop.api('/'+intData.id+'/likes', handlePostLiked);
               }
          }

          protected function handlePostUnliked(response:Object, fail:Object):void {
               loading.visible = false;
               if (response) {
                    var objet:Object = response as Object;
                    intData.likes--;
                    intData.user_likes = false;
                    populateLikeCount();
               }
          }

          protected function handlePostLiked(response:Object, fail:Object):void {
               loading.visible = false;
               if (response) {
                    (intData.likes == null)?intData.likes = 1:intData.likes++;
                    intData.user_likes = true;
                    populateLikeCount();
               }
          }

thanks

Original issue reported on code.google.com by 22ro...@gmail.com on 9 Oct 2010 at 12:41

GoogleCodeExporter commented 9 years ago
Have you tried setting the request method to "POST"?  If you look at the docs:

http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/index.h
tml

you'll see the signature for the api method is:

public static function api(method:String, callback:Function, params:* = null, 
requestMethod:String = GET):void

which defaults to a requestMethod of GET.  You want to do a POST.  Try the 
following:

FacebookDesktop.api('/'+intData.id+'/likes', handlePostLiked, null, "POST");

Original comment by alan...@gmail.com on 11 Oct 2010 at 4:41

GoogleCodeExporter commented 9 years ago
yes, I changed GET to POST and its works but there is one problem,
if I got like, then it is impossible to make unlike.

how to solve this issue??!!

my script looks like this:

if (intData.user_likes) {           
   FacebookDesktop.api('/'+intData.id+'/likes', handlePostUnliked, null, 'POST');
}else {                     
   FacebookDesktop.api('/'+intData.id+'/likes', handlePostLiked, null, 'POST');
}

thanks

Original comment by 22ro...@gmail.com on 11 Oct 2010 at 5:31

GoogleCodeExporter commented 9 years ago
To unlike, instead of POST, use DELETE.

You can also take a look here:

http://developers.facebook.com/docs/api

Original comment by alan...@gmail.com on 14 Oct 2010 at 6:18

GoogleCodeExporter commented 9 years ago

Original comment by edwar...@gmail.com on 12 Jan 2011 at 10:56

GoogleCodeExporter commented 9 years ago
all works ok!

Original comment by 22ro...@gmail.com on 13 Jan 2011 at 7:30

GoogleCodeExporter commented 9 years ago
I'm trying to like a page/post, like you have done, using Facebook.api() 
instead of FacebookDesktop.api() but I always receive this error:

"error":{"type":"OAuthException","message":"(#200) App does not have permission 
to make this call"

even if I've set ALL the permission.

This is my code

protected function LikePage(e:MouseEvent):void {
    var values:URLVariables = new URLVariables();
    values.url = "http://www.facebook.com/pages/MY_PAGE/MY_PAGE_ID";

    Facebook.api('/MY_PAGE_ID/likes', handleLikePosted, values, 'POST');
}

protected function handleLikePosted(response:Object, fail:Object):void {
        if (response) {
          debug.appendText("handleLikePosted\n");
        }
}

Where I'm going wrong??? Anybody can help me??

Thanks

Original comment by assurda...@gmail.com on 8 Mar 2011 at 2:55

GoogleCodeExporter commented 9 years ago
Hi, 

i tried it but i does not work for me. My Alert will be not shown.

Facebook.api('/'+intData.id+'/likes', handlePostUnliked, null, 'DELETE');

protected function handlePostUnliked(result:Object, fail:Object):void {
Alert.show("TEST");

Original comment by gulsun.falke@gmail.com on 8 Jun 2011 at 3:30

GoogleCodeExporter commented 9 years ago
gulsun.falke, you need to pass in some params in your call. Ex)

var params:Object = {method: URLRequestMethod.DELETE};
Facebook.api('/'+intData.id+'/likes', handlePostUnliked, params, 
URLRequestMethod.POST);

Original comment by rovertn...@gmail.com on 10 Jun 2011 at 7:23