Question

I'm trying to post a message on user's wall defined by it's ID, but in response I'm getting an error "Unknown method".

My code is:

final Bundle params = new Bundle();

params.putByteArray("message", "Test".getBytes());
params.putByteArray("name", "American Virgin".getBytes());
params.putByteArray("link", "http://bit.ly/12345".getBytes());
params.putByteArray("description", "A Freshman College Girl on a scholarship from an ...".getBytes());
params.putByteArray("picture", "http://xxx/MOV1026.jpg".getBytes());

final Request postToWall = Request.newRestRequest(Session.getActiveSession(), 
                                                    "/" + pickedUsersId.get(0) + "/feed", params, HttpMethod.POST);
postToWall.setCallback( new Request.Callback() 
{

    @Override
    public void onCompleted(Response response) 
    {
        Log.i(Utils.LOG, response.toString());

    }
});
Request.executeBatchAsync(postToWall);

In LogCat i have:

11-08 17:34:29.136: I/LOG(21699): {Response:  responseCode: 200, graphObject: null, error: {FacebookServiceErrorException: httpResponseCode: 200, facebookErrorCode: 3, facebookErrorType: null, message: Unknown method}, isFromCache:false}
Was it helpful?

Solution

Everything looks right except the graphPath parameter in your Request method. Instead of:

"/" + pickedUsersId.get(0) + "/feed"

do:

pickedUsersId.get(0) + "/feed"

There should not be a leading slash "/" in front of your graph path. You can always refer to our documentation to see how exactly to publish to feed. https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top