Reputation: 3900
I'm trying to Attend a facebook user to an event, with
Request.executePostRequestAsync(...)
but the server always returns with the following:
{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"FACEBOOK_NON_JSON_RESULT":false}}, error: null, isFromCache:false}
The authentication works, I can get the user infos, etc... I tried laso my link with the Graph API Explorer and it worked there, so something should be wrong with my code. I checked also my permissions, they are allright. I'd be pleased if someone could help me, here is my code:
List<String> permissions = new ArrayList<String>();
permissions.add("rsvp_event");
private void attendToEvent(final String eventID){
Session.openActiveSession(MainActivity.this, true, new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
Session actSession = Session.getActiveSession();
if (!hasRSVPEventPermission() && actSession.isOpened()) {
actSession.requestNewPublishPermissions(new Session.NewPermissionsRequest(MainActivity.this, permissions));
}
String accessToken = actSession.getAccessToken();
String path = new String("https://graph.facebook.com/"+eventID+"/attending");
if(session != null && session.isOpened()){
JSONObject jo = new JSONObject();
final GraphObject go = GraphObject.Factory.create(jo);
Request.executePostRequestAsync(session, path, go, new Request.Callback() {
//Request.executeGraphPathRequestAsync(session, path, new Request.Callback() {
@Override
public void onCompleted(Response response) {
System.out.println(response.toString());
showAttendResult(response.getGraphObject(), response.getError());
}
});
}
}
});
}
private boolean hasRSVPEventPermission() {
Session session = Session.getActiveSession();
return session != null && session.getPermissions().contains("rsvp_event");
}
Upvotes: 0
Views: 1702
Reputation: 3900
I found it out! The problem was, the instead of this path:
String path = new String("https://graph.facebook.com/"+eventID+"/attending");
the Graph API expects this:
String path = new String(eventID+"/attending");
So without the "http://graph.facebook.com/" !
Upvotes: 1