i'm trying attend facebook user event,
request.executepostrequestasync(...) but server returns following:
{response: responsecode: 200, graphobject: graphobject{graphobjectclass=graphobject, state={"facebook_non_json_result":false}}, error: null, isfromcache:false} the authentication works, can user infos, etc... tried laso link graph api explorer , worked there, should wrong code. checked permissions, allright. i'd pleased if me, here 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"); }
i found out! problem was, instead of path:
string path = new string("https://graph.facebook.com/"+eventid+"/attending"); the graph api expects this:
string path = new string(eventid+"/attending"); so without "http://graph.facebook.com/" !
Comments
Post a Comment