agorapulse / grails-facebook-sdk

Facebook SDK Grails Plugin
http://agorapulse.github.com/grails-facebook-sdk/guide
30 stars 13 forks source link

Using the old graph api v1.0 with facebookClient? #70

Closed PatrickHuetter closed 9 years ago

PatrickHuetter commented 10 years ago

Is it possible to use the old graph api v1.0 with facebookClient? Where can i configure the api base url or version?

I would like to use the old graph api for some requests because the new one is missing some features.

benorama commented 10 years ago

Are you sure that you are pointing to api v2.0 ?

By default it looks like graph.facebook.com default endpoint still uses v1.0: http://graph.facebook.com/594317994 -> Same result as v1.0 endpoint http://graph.facebook.com/v1.0/594317994 http://graph.facebook.com/v2.0/594317994

PatrickHuetter commented 10 years ago

That's strange because i get the following exception using restFB from your plugin while creating an event over the API (example code from the restFB website):

Received Facebook error response of type OAuthException: (#12) events management API is deprecated for versions v2.0 and higher (code 12, subcode null). Stacktrace follows:
Message: Received Facebook error response of type OAuthException: (#12) events management API is deprecated for versions v2.0 and higher (code 12, subcode null)
    def createEvent(String name, Date startTime, String accessToken, Map params = [:]) {
        params.put("name", name)
        params.put("start_time", startTime)
        def facebookClient = new FacebookGraphClient(accessToken)

        // Publishing an event
        FacebookType publishEventResponse = facebookClient.publish("me/events", FacebookType.class,
                Parameter.with("name", "Party"), Parameter.with("start_time", startTime));

        println("Published event ID: " + publishEventResponse.getId());
    }
benorama commented 10 years ago

Strange... Anyway, if it's going to be deprecated, it would wise not to use it ;). I think that API V1.0 is going to be shutdown next year. Waiting for the RestFB upgrade...

PatrickHuetter commented 10 years ago

@benorama Yes it's going to be deprecated and i'll use the new api in future, but i need api v1.0 until facebook shuts it down, because i need to create an event over the api.....that's my problem and there doesn't seem to be an alternative solution... in worst case i have to build a facebook-bot or crawler but that's not the preferred way and against the facebook rules.

I'll search for a solution to create an event with restfb furthermore. If you have any suggestions or tips, i would be glad to hear from you :-)

Thank you und best regards, Patrick

benorama commented 10 years ago

Have you tried to use the Graph API Explorer to execute your request? (you can choose v1 or v2 API version)

If it works, then you can just create the request yourself with HttpBuilder.

PatrickHuetter commented 10 years ago

@benorama Got it working with the RestFB Client. The problem was that all new apps that you create on facebook are graph 2.0 apps and you can't downgrade. I had some old apps i didn't use anymore, they had access to both, 2.0 and 1.0 of the graph api. I've chosen one of the old ones and it worked!

Krunalvaghasiya commented 7 years ago

@PatrickHuetter @benorama

checkins API is deprecated for versions v2.0 and higher

I am getting these error while implementing checkins button .Do not know how to implement . I have tried various solutions .

Please help .!

Thanks.