问题
I want to get the id, title, summary, start-date, end-date, is-current and company name for each position that a LinkedIn member has entered on its profile.
I tested a query on the REST Console and I got the desired result. The query is "https://api.linkedin.com/v1/people/~/positions:(id,title,summary,start-date,end-date,is-current,company)?format=json".
The problem is that when I try to do the same thing using the LinkedIn javascript SDK I'm not getting the whole list of fields for each position. I'm getting the complete list of positions, but not all the fields for each position.
This is the call that I'm doing with the javascript SDK:
//in this function I'm specifying the list of fields that I want to retrieve for each position
//but I'm getting only some fields (id, start-date and end-date)
function getProfileData() {
IN.API.Raw("/people/~/positions:(id,title,summary,start-date,end-date,is-current,company)?format=json").result(onSuccess).error(onError);
}
Somebody has any idea of what I need to do to get the same result than using the REST Console?
回答1:
Requesting URL is wrong.
Use following for positions
https://api.linkedin.com/v1/people/~:(id,positions)?format=json
Use following for locations
https://api.linkedin.com/v1/people/~:(id,location)?format=json
回答2:
If you want to retrieve your profile data use this,
IN.API.Profile("me")
.fields([
"firstName","lastName","headline","positions:(company,title,summary,startDate,endDate,isCurrent)","industry",
"location:(name,country:(code))","pictureUrl","publicProfileUrl","emailAddress",
"educations","dateOfBirth"])
.result(onSuccess)
.error(onError);
(or) If you want to retrieve other profile data then replace "me
" with "<public profile url>
"
IN.API.Profile("url=https://nl.linkedin.com/in/williamhgates")
.fields([
"firstName","lastName","headline","positions:(company,title,summary,startDate,endDate,isCurrent)","industry",
"location:(name,country:(code))","pictureUrl","publicProfileUrl","emailAddress",
"educations","dateOfBirth"])
.result(onSuccess)
.error(onError);
来源:https://stackoverflow.com/questions/28686754/how-to-retrieve-the-list-of-positions-including-all-the-fields-using-the-linkedi