spring-attic / spring-social-linkedin

LinkedIn API binding and connect support.
http://projects.spring.io/spring-social-linkedin
Apache License 2.0
72 stars 71 forks source link

User Profile Full : error org.springframework.social.UncategorizedApiException #72

Open fritzZz opened 6 years ago

fritzZz commented 6 years ago

Hi all,

I'm using the version 1.0.2.RELEASE of this library and in the last days when I call the API

linkedin.profileOperations().getUserProfileFull()

I got this error :

ERROR [com.fluttr.site.controllers.signin.SigninControllerWebSite] (default task-26) Throwable full profile: org.springframework.social.UncategorizedApiException: at org.springframework.social.linkedin.api.impl.LinkedInErrorHandler.handleUncategorizedError(LinkedInErrorHandler.java:62) [spring-social-linkedin-1.0.2.RELEASE.jar:1.0.2.RELEASE] at org.springframework.social.linkedin.api.impl.LinkedInErrorHandler.handleError(LinkedInErrorHandler.java:55) [spring-social-linkedin-1.0.2.RELEASE.jar:1.0.2.RELEASE] at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:616) [spring-web-4.1.9.RELEASE.jar:4.1.9.RELEASE] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:572) [spring-web-4.1.9.RELEASE.jar:4.1.9.RELEASE] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:547) [spring-web-4.1.9.RELEASE.jar:4.1.9.RELEASE] at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:255) [spring-web-4.1.9.RELEASE.jar:4.1.9.RELEASE] at org.springframework.social.linkedin.api.impl.ProfileTemplate.getUserProfile(ProfileTemplate.java:123) [spring-social-linkedin-1.0.2.RELEASE.jar:1.0.2.RELEASE] at org.springframework.social.linkedin.api.impl.ProfileTemplate.getUserProfileFull(ProfileTemplate.java:92) [spring-social-linkedin-1.0.2.RELEASE.jar:1.0.2.RELEASE]

Maybe something in the Linkedin Api has been changed, I want to know if there is any way to avoid this kind of errors during response parsing.

Thank you

imod commented 6 years ago

@habuma I found the issue causing this... the call linkedin.profileOperations().getUserProfileFull() asks for the field current-share if I remove this from the API call, then the request works again.

This is a working call (I removed current-share): https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,location,industry,distance,relation-to-viewer,num-connections,num-connections-capped,summary,specialties,proposal-comments,associations,honors,interests,positions,publications,patents,languages,skills,certifications,educations,three-current-positions,three-past-positions,num-recommenders,recommendations-received,phone-numbers,im-accounts,twitter-accounts,date-of-birth,main-address,member-url-resources,picture-url,site-standard-profile-request:(url),api-public-profile-request:(url),site-public-profile-request:(url),api-standard-profile-request,public-profile-url,email-address)?format=json

I have no idea why... the field is still listed in the list of fields for basic-profile: https://developer.linkedin.com/docs/fields/basic-profile

imod commented 6 years ago

btw. just to get it work again, I did a custom build for us. The only change I made was this: https://github.com/yooture/spring-social-linkedin/commit/b2cdc9459ae809eed1d147cce7c2f4f51e3d353c ...I don't think/know this is the correct fix for the whole library, but as we don't care about the value of this field anyway, so this is good enough.

fritzZz commented 6 years ago

Thank you! I need a suggestion! How can I use your bugfix? Asking for a new release or building your code and import the jar as a local library? I use to work with maven!

imod commented 6 years ago

a fix by the maintainers of this library would be the perfect solution, but unfortunate spring-social-linkedin seems not to have a lot of love lately... If you want, you can just do a build of this branch and be done for now: https://github.com/yooture/spring-social-linkedin/tree/remove_current-share just be aware, this just fixes the current issue with the UncategorizedApiException when calling .getUserProfileFull() - we don't need a lot of the other functionality and therefore I have no idea if there are any other things it brakes. For us, this is good enough for now, not sure about your use case....