根据这些文档,我应该请求“电子邮件地址”:https://developer.linkedin.com/documents/profile-fields
我认为这与其他用户数据调用类似,因此我正在通过oauth过程获取正确的令牌,然后使用oauth2库执行以下操作(在Python中):
In [30]: url='http://api.linkedin.com/v1/people/~:(id,first-name,industry,email-address)'
In [31]: resp, content = client.request(url, 'GET')
In [32]: content
Out[32]: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<person>\n <id>t0tImGn-yi</id>\n <first-name>Jeff</first-name>\n <industry>Computer Software</industry>\n</person>\n'
如您所见,响应中没有电子邮件地址。
我还应该注意到,我尝试在requestToken请求中使用以下方式指定范围:
request_token_url = 'https://api.linkedin.com/uas/oauth/requestToken?scope=r_basic_profile+r_emailaddress'
更新:我在此处找到了其他文档:https://developer.linkedin.com/documents/authentication#toggleview:id=python,这些文档似乎暗示我应该通过访问以下内容来尝试访问电子邮件地址: resp, content = client.request('http://api.linkedin.com/v1/people/~/email-address', 'GET')
在这种情况下,content返回“null”。