簡體   English   中英

無法使用Scribe從Linkedin API獲得技能

[英]Unable to get skills from Linkedin API using Scribe

我正在嘗試使用Scribe庫從LinkedIn獲得技能信息。

一切正常。 但是它不能以XML或JSON格式輸出技能。

我檢查了URL: https ://api.linkedin.com/v1/people/~:(id,skills 在apigee中。 工作正常。 所以我想知道代碼中有什么問題。

這是代碼:

public class LinkedInExample {
   private static final String PROTECTED_RESOURCE_URL = "https://api.linkedin.com/v1/people/~:(id,skills)";

   public static void main(String[] args) {
      OAuthService service = new ServiceBuilder()
                             .provider(LinkedInApi.class)
                             .apiKey("KEY")
                             .apiSecret("SECRET")
                             .build();
      Scanner in = new Scanner(System.in);

      // Obtain the Request Token
      Token requestToken = service.getRequestToken();

      System.out.println(service.getAuthorizationUrl(requestToken));
      System.out.println("And paste the verifier here");
      System.out.print(">>");
      Verifier verifier = new Verifier(in.nextLine());

      // Trade the Request Token and Verfier for the Access Token
      System.out.println("Trading the Request Token for an Access Token");
      Token accessToken = service.getAccessToken(requestToken, verifier);
      System.out.println("Got the Access Token!");

      // Now let's go and ask for a protected resource!
      OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
      service.signRequest(accessToken, request);
      Response response = request.send();
      System.out.println(response.getBody());

   }
}

此代碼的輸出類似於:

{"id": "UU4glj53pm"}

技能的信息丟失。

我只是發現我的應用程序必須獲得r_fullprofile成員許可才能獲得LinkedIn API的技能信息。 因此,代碼中沒有錯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM