I'm trying to get a list of friends, but I get an error

public void graphApiGetFriends() { AccessToken token = AccessToken.getCurrentAccessToken(); Log.wtf(TAG, "Facebook token: " + token.getToken()); new GraphRequest( AccessToken.getCurrentAccessToken(), "/{friend-list-id}", null, HttpMethod.GET, new GraphRequest.Callback() { public void onCompleted(GraphResponse response) { /* handle the result */ Log.wtf(TAG, "Response error: " + response.getError()); Log.wtf(TAG, "Raw: " + response.getRawResponse()); Log.wtf(TAG, "Array: " + response.getJSONArray()); Log.wtf(TAG, "Object: " + response.getJSONObject()); } } ).executeAsync(); } 

And I catch:

 Response error: {HttpStatus: 404, errorCode: 803, errorType: OAuthException, errorMessage: (#803) Some of the aliases you requested do not exist: {friend-list-id}} 

I change to friend-list-id and get the same thing, there is at least one friend who has an application installed and he logged in

    1 answer 1

    In general, the problem was that the path was specified incorrectly and my Facebook Id missing at the beginning of the path. As a result, the request looks like this:

     /** * Request to GrapApi for get friends list */ public void graphApiGetFriends() { AccessToken token = AccessToken.getCurrentAccessToken(); String userId = token.getUserId(); String path = "/friends"; new GraphRequest( token, userId + path, null, HttpMethod.GET, new GraphRequest.Callback() { public void onCompleted(GraphResponse response) { /* handle the result */ Log.wtf(TAG, "Response error: " + response.getError()); Log.wtf(TAG, "Raw: " + response.getRawResponse()); } } ).executeAsync(); } 

    In response to the request comes a list of friends who have installed the application.