"Invalid Member Id" 在 Android 和 API 控制台上正常工作

"Invalid Member Id" on Android and on API console works normally

我使用 Retrofit 库来管理与 LinkedIn 的 REST 通信。

拒绝界面

public interface LinkedInManager {
    String BASE_URL = "https://api.linkedin.com/v1";

    @GET("/people/~")
    Profile getUserInfo();

    @GET("/people/id={id}")
    void getUserInfo(@Path("id") String id, Callback<Profile> cb);
}

我尝试获取用户信息

 RestAdapter.Builder builder = new RestAdapter.Builder();
        builder
                .setEndpoint(LinkedIn.BASE_URL)
                .setConverter(new GsonConverter(new Gson())).setClient(new OkClient(new OkHttpClient()));

        final String accessToken = getIntent().getExtras().getString(PACKAGE_NAME + ".accessToken");
        if (accessToken != null) {
            builder.setRequestInterceptor(new RequestInterceptor() {
                @Override
                public void intercept(RequestInterceptor.RequestFacade request) {
                    request.addQueryParam("oauth2_access_token", accessToken);
                    request.addQueryParam("format", "json");
                }
            });
        }
        builder.setLogLevel(RestAdapter.LogLevel.FULL);
        RestAdapter restAdapter = builder.build();
        final LinkedIn linkedIn = restAdapter.create(LinkedIn.class);
        linkedIn.getUserInfo("cQEjnKL6pD",callback);

当我发送请求时,我收到

{
  "errorCode": 0,
  "message": "Invalid member id {cQEjnKL6pD}",
  "requestId": "MYEIGI80KX",
  "status": 404,
  "timestamp": 1426989602678
}

但是当我在 LinkedIn API Console 中检查此方法时,一切正常。

来自我的应用程序的请求:

https://api.linkedin.com/v1/people/id=cQEjnKL6pD?oauth2_access_token=AQUjGuS8emH9DaZAkRtTtD8LgLnyApDoRhEc_8czX_8zRGngjiBahKBS15Y2rTCyL4rJHQMe7NYDZTECph59PCVCzaKSvosKevKqVyQwsXmMtEH-Abf3GyqPiNAfSswzvRU_nCW5ToEY-DgGiNif4V-JEyh99JuxNPPAIehE8Vi47oJOyl0&format=json

来自控制台的请求:

https://api.linkedin.com/v1/people/id=cQEjnKL6pD?oauth2_access_token=AQVZh_28bwO32ja2s3Kn0AzqYh3LyM_xqpTMXMshYawAvgjSYhl0GRDtxOjnFTscxqLtVMzxHl8J6EFJagwq1rUAR1_GCtZvMLxxkPOoBlpkj04T43aphfUDy85a6gyDTjxxZjBtKsCtasd95aEwoAm8M0PFfxAjYxWvoIOW1i3xDDDfYKo&format=json 

两者都给我不同的结果。第一 - "Invalid member id",第二 - 正常工作。谁能解释一下哪里出了问题?

供以后搜索。

根据LinkedIn API docs

id A unique identifying value for the member.

This value is linked to your specific application. Any attempts to use it with a different application will result in a "404 - Invalid member id" error.