简体   繁体   中英

Graph API Query Using JavaScript API For Open Graph Actions And Objects

when I use "me/nativeamericannews:be_proud_of/story?" in the Graph API Explorer, it correctly gives me a JSON response, but when I try to get that same response from my canvas app, it always provides an error. I have looked all over, but cannot see how I should be attempting to query for user interactions with my objects and actions. I am querying like this (be_proud_of is one of my actions and story is one of my objects):

function checkProudOf() {
    FB.api('/me/nativeamericannews:be_proud_of/story', 'post', function(response) {
        if (!response || response.error) {
            alert('Error occurred');
        } else {
            alert('Post for Info was successful! Action ID: ' + response.id);
        }
    });
}

I post the actions and everything works fine with:

function postProudOf() {
    FB.api('/me/nativeamericannews:be_proud_of' + '?story=' + encodeURI(document.URL), 'post', function(response) {
        if (!response || response.error) {
            // alert('Error occurred');
        } else {
            // alert('Post was successful! Action ID: ' + response.id);
        }
    });
}

Any ideas? I want to be able to display aggregations and a user's history with my objects and actions when they visit my app. Thanks!

well, that was embarrassing. it was pretty simple, in the end. when i am reading the info from facebook, it is a "get" rather than a "post".

that fixed that issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM