Token problem - I would like to get the events of a user

15 views
Skip to first unread message

guillaume kotarba

unread,
Feb 22, 2017, 6:38:05 PM2/22/17
to Facebook4J
Hi all,
I would like to get the events of a user like that : 
GET/v2.8/me/events?fields=id,name&since=2017-02-23

So i did this code in my java to test what I get :

public class JavaApplication1 {


   
/**
     * @param args the command line arguments
     */

   
public static void main(String[] args) throws JSONException, IOException, FacebookException {
       
       
       
Facebook facebook = new FacebookFactory().getInstance();
       
        facebook
.setOAuthAppId("...", "...");
        facebook
.getOAuthAppAccessToken();
       
       
BatchRequests<BatchRequest> batch = new BatchRequests<BatchRequest>();
        batch
.add(new BatchRequest(RequestMethod.GET, "theIduser"));
        batch.add(new BatchRequest(RequestMethod.GET, "theIduser/events?fields=id,name&since=2017-02-23"));
       
List<BatchResponse> results = facebook.executeBatch(batch);


       
System.out.println(results);
   
}
   
}

However i get empty data like this : 
"body":"{\"data\":[]}"}}

I know there is a pb with the token, maybe it doesn't have the right permission. 

So the question is, How can I initialize a token with this permission in my java code ?

Thank you !

guillaume kotarba

unread,
Feb 22, 2017, 6:40:57 PM2/22/17
to Facebook4J
I need to use an APP TOKEN
Reply all
Reply to author
Forward
0 new messages