从LinkedIn API响应中检索配置文件图像

问题描述 投票:1回答:1

我已通过身份验证,并从LinkedIn收到正确的数据并收到响应,如以下链接所示:

https://developer.linkedin.com/docs/ref/v2/profile/profile-picture

但是,我不确定如何从中提取图像:

"displayImage": "urn:li:digitalmediaAsset:C4D03AQGsitRwG8U8ZQ",

我是否需要再次提出图像网址的请求?

linkedin linkedin-api
1个回答
6
投票

对于其他任何人看,我忽略了有一个像这样的identifier字段的网址:

"identifiers": [
 {
  "identifier": "https://media.licdn.com/dms/image/C4D03AQGsitRwG8U8ZQ/profile-displayphoto-shrink_100_100/0?e=1526940000&v=alpha&t=12345",
  "file": "urn:li:digitalmediaFile:     (urn:li:digitalmediaAsset:C4D03AQGsitRwG8U8ZQ,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_100_100,0)",
    "index": 0,
    "mediaType": "image/jpeg",
    "identifierExpiresInSeconds": 1526940000
}

为了在ruby中获得上述响应,我正在执行以下操作:

url = 'https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))'
res = RestClient.get(url, Authorization: "Bearer #{access_token}")
© www.soinside.com 2019 - 2024. All rights reserved.