LinkedIn API v2 with Sparkle.LinkedInNET:检索摘要和技能
LinkedIn API v2 with Sparkle.LinkedInNET: Retrieve summary and skills
我正在实施 LinkedIn API reader 以获取用户的摘要和技能。
OAuth2 身份验证过程工作正常,但当我尝试检索配置文件对象时,我被困在这里:
public void OAuth2(string code, string state, string error, string error_description)
{
// create a configuration object
var config = new LinkedInApiConfiguration("api-key", "api-secret-code");
// get the APIs client
var api = new LinkedInApi(config);
if(!string.IsNullOrEmpty(error) || !string.IsNullOrEmpty(error_description))
{
// handle error and error_description
}
else
{
var redirectUrl = "http://mywebsite/LinkedIn/OAuth2";
var userToken = api.OAuth2.GetAccessToken(code, redirectUrl);
var user = new UserAuthorization(userToken.AccessToken);
var profile = api.Profiles.GetMyProfile(user); //Here I don't know what to pass as acceptLanguages and FieldSelector!!
}
}
没有给定的参数对应于 'ProfilesApi.GetMyProfile(UserAuthorization, string[], FieldSelector)'
的所需形式参数 'acceptLanguages'
我试图从 Sparkle.LinkedIn Api 项目中了解,但没有文档。
我只想检索摘要和技能字段。
通过创建一个包含语言代码和 FIeldSelector 变量的简单数组来解决:
var acceptLanguages = new string[] { "it-IT","en-US", };
var fields = FieldSelector.For<Person>()
.WithId()
.WithFirstName()
.WithLastName()
.WithFormattedName()
.WithEmailAddress()
.WithHeadline()
.WithLocationName()
.WithLocationCountryCode()
.WithPictureUrl()
.WithPublicProfileUrl()
.WithSummary();
Person profile = api.Profiles.GetMyProfile(user,acceptLanguages,fields);
我正在实施 LinkedIn API reader 以获取用户的摘要和技能。 OAuth2 身份验证过程工作正常,但当我尝试检索配置文件对象时,我被困在这里:
public void OAuth2(string code, string state, string error, string error_description)
{
// create a configuration object
var config = new LinkedInApiConfiguration("api-key", "api-secret-code");
// get the APIs client
var api = new LinkedInApi(config);
if(!string.IsNullOrEmpty(error) || !string.IsNullOrEmpty(error_description))
{
// handle error and error_description
}
else
{
var redirectUrl = "http://mywebsite/LinkedIn/OAuth2";
var userToken = api.OAuth2.GetAccessToken(code, redirectUrl);
var user = new UserAuthorization(userToken.AccessToken);
var profile = api.Profiles.GetMyProfile(user); //Here I don't know what to pass as acceptLanguages and FieldSelector!!
}
}
没有给定的参数对应于 'ProfilesApi.GetMyProfile(UserAuthorization, string[], FieldSelector)'
的所需形式参数 'acceptLanguages'我试图从 Sparkle.LinkedIn Api 项目中了解,但没有文档。
我只想检索摘要和技能字段。
通过创建一个包含语言代码和 FIeldSelector 变量的简单数组来解决:
var acceptLanguages = new string[] { "it-IT","en-US", };
var fields = FieldSelector.For<Person>()
.WithId()
.WithFirstName()
.WithLastName()
.WithFormattedName()
.WithEmailAddress()
.WithHeadline()
.WithLocationName()
.WithLocationCountryCode()
.WithPictureUrl()
.WithPublicProfileUrl()
.WithSummary();
Person profile = api.Profiles.GetMyProfile(user,acceptLanguages,fields);