我能够在v1 Linkedin Api中收到的字段,例如具有r_basicprofile权限的位置,不再从请求中返回。我知道有些字段已被弃用,但是没有关于替换这些字段的对象的详细文档。如下面的文档中所述,不建议使用位置字段,但是还有另一个对象,例如应该从请求返回的位置。文档未能提供有关职位的更多详细信息。 #LinkedIn
https://docs.microsoft.com/en-us/linkedin/shared/references/v2/profile/basic-profile
您可以在下面找到代码段。
data = None
params = {'oauth2_access_token': token}
url = 'https://api.linkedin.com/v2/me?projection (id,firstName,lastName,profilePicture,positions)'
headers = {'Content-Type': 'application/json','X-RestLi-Protocol-Version':'2.0.0'}
kw = dict(data=data, params=params,headers=headers, timeout=60)
response = requests.request("GET", url, **kw)
status_code = response.status_code
#content = json.loads(response.content)
return response.content
我相信你要找的是从你的应用程序中从r_basicprofile
迁移到r_liteprofile
。看看这个:
https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq
我相信你的url查询是正确的,但这里有关于(例如)Profile Picture字段和示例响应的文档:
LinkedIn API最近发生了很多变化。希望这可以帮助!