Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法使用Scribe从Linkedin API获取技能_Java_Linkedin_Scribe - Fatal编程技术网

Java 无法使用Scribe从Linkedin API获取技能

Java 无法使用Scribe从Linkedin API获取技能,java,linkedin,scribe,Java,Linkedin,Scribe,我正在尝试使用Scribe库从LinkedIn获取技能信息 一切正常。但它无法以XML或JSON格式打印技能 我查了网址:在apigee。它很好用。所以我想知道代码中出了什么问题 代码如下: public class LinkedInExample { private static final String PROTECTED_RESOURCE_URL = "https://api.linkedin.com/v1/people/~:(id,skills)"; public stat

我正在尝试使用Scribe库从LinkedIn获取技能信息

一切正常。但它无法以XML或JSON格式打印技能

我查了网址:在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的技能信息。因此代码中没有错误。

您遇到了什么样的错误?@mazaneicha我没有遇到错误。它只是打印出一个空白的{}来显示技能。其他配置文件字段(如id、姓氏)正在工作。