SparkleNetworks / LinkedInNET

Sparkle.LinkedInNET will help you query the LinkedIn API with C# :)
https://www.nuget.org/packages/Sparkle.LinkedInNET/
GNU Lesser General Public License v3.0
35 stars 51 forks source link

Profille Info api throws an exception while submitting all fields #15

Closed differenz-manan closed 4 years ago

differenz-manan commented 7 years ago

Hi, I'm getting exception in retrieving people profile info api with all fields.

Here is my code. var profile = api.Profiles.GetMyProfile(user, acceptLanguages, FieldSelector.For<Person>().WithAllFields());

Exception details:

API error (400) Duplicate field {Position.id} 
in inline filter {(id,title,start-date,end-date,is-current,company,id,title,summary,start-date,end-date,is-current,company),picture-url,api-standard-profile-request:(url,headers),public-profile-url,email-address,last-modified-timestamp,proposal-comments,associations,interests,publications,patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name,person),date,url),languages:(id,language,proficiency),skills,certifications:(id,name,authority:(name),number,start-date,end-date),educations,courses,volunteer:(volunteer-experiences:(id,role,organization:(name),cause:(name))),three-current-positions,three-past-positions,num-recommenders,recommendations-received:(id,recommendation-type:(code),recommendation-text,recommender:(id,first-name,last-name,num-connections,headline)),following,job-bookmarks,suggestions,date-of-birth,member-url-resources,related-profile-views,honors-awards,phone-numbers,bound-account-types,im-accounts,main-address,twitter-accounts,primary-twitter-account,connections,group-memberships,network)} 
at https://api.linkedin.com/v1/people/~:(first-name,last-name,headline,site-standard-profile-request,id,maiden-name,formatted-name,phonetic-first-name,phonetic-last-name,formatted-phonetic-name,location:(name,country:(code)),industry,distance,relation-to-viewer,current-status-timestamp,current-share,num-connections,num-connections-capped,summary,specialties,positions:(id,title,start-date,end-date,is-current,company,id,title,summary,start-date,end-date,is-current,company),picture-url,api-standard-profile-request:(url,headers),public-profile-url,email-address,last-modified-timestamp,proposal-comments,associations,interests,publications,patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name,person),date,url),languages:(id,language,proficiency),skills,certifications:(id,name,authority:(name),number,start-date,end-date),educations,courses,volunteer:(volunteer-experiences:(id,role,organization:(name),cause:(name))),three-current-positions,three-past-positions,num-recommenders,recommendations-received:(id,recommendation-type:(code),recommendation-text,recommender:(id,first-name,last-name,num-connections,headline)),following,job-bookmarks,suggestions,date-of-birth,member-url-resources,related-profile-views,honors-awards,phone-numbers,bound-account-types,im-accounts,main-address,twitter-accounts,primary-twitter-account,connections,group-memberships,network)

Please help me with this problem.

Thank you. Manan

sandrock commented 7 years ago

It seems there is a bug in the code responsible for generating the profile fields.

positions:(id,title,start-date,end-date,is-current,company,id,title,summary,start-date,end-date,is-current,company),
three-current-positions,
three-past-positions,

There is no positions field. The sub-fields for three-current-positions and three-past-positions seem to aggregate in the positions virtual field.

I suggest you specify the fields you desire by hand or with the extension methods.

You (or someone else) may also fix the bug by following those steps:

sandrock commented 7 years ago

Here is a workaround inspired by your PR:

var profile = api.Profiles.GetMyProfile(
    user,
    FieldSelector.For<Person>().AddRange("first-name", "last-name", "headline", "site-standard-profile-request", "id", "maiden-name", "formatted-name", "phonetic-first-name", "phonetic-last-name", "formatted-phonetic-name", "location:(name)", "location:(country:(code))", "industry", "distance", "relation-to-viewer", "current-status-timestamp", "current-share", "num-connections", "num-connections-capped", "summary", "specialties", "positions:(id,title,start-date,end-date,is-current,company,summary)", "picture-url", "site-standard-profile-request", "api-standard-profile-request:(url)", "api-standard-profile-request:(headers)", "public-profile-url", "email-address", "last-modified-timestamp", "proposal-comments", "associations", "interests", "publications", "patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name,person),date,url)", "languages:(id)", "languages:(language)", "languages:(proficiency)", "skills", "certifications:(id,name,authority:(name),number,start-date,end-date)", "educations", "courses", "volunteer:(volunteer-experiences:(id,role,organization:(name),cause:(name)))", "three-current-positions", "three-past-positions", "num-recommenders", "recommendations-received", "recommendations-received:(id,recommendation-type:(code),recommendation-text,recommender:(id,first-name,last-name,num-connections,headline))", "following", "job-bookmarks", "suggestions", "date-of-birth", "member-url-resources", "related-profile-views", "honors-awards", "phone-numbers", "bound-account-types", "im-accounts", "main-address", "twitter-accounts", "primary-twitter-account", "connections", "group-memberships", "network"));
sandrock commented 4 years ago

This project is not maintained any more. Please check the README page to find alternatives.