LinkedIn Groups API - Getting group logo for multiple groups in a single API request

℡╲_俬逩灬. 提交于 2019-12-02 10:25:28

问题


Using LinkedIn Groups API, I am showing a list of groups the user is a member of on LinkedIn. Getting the list of groups in a single call is clear using

https://api.linkedin.com/v1/people/~/group-memberships:(group:(id,name),membership-state)?count=50&start=0&oauth2_access_token=' . $accessKey;

Task

Now, I want to show the group logo image alongside the group name. However, this would mean for n groups, I have to do n more API calls, and this slows down the page load (e.g. for 50 groups).

The documentation states,

You can access details about one or more groups such as the ID, name, settings, and posts from any groups resource path.

https://api.linkedin.com/v1/groups/{group-id}:(id,name,short-description,description,relation-to-viewer:(membership-state,available-actions),posts,counts-by-category,is-open-to-non-members,category,website-url,locale,location:(country,postal-code),allow-member-invites,site-group-url,small-logo-url,large-logo-url)

I want to get the logo images of the mentioned group ids in a single API call.

What I have tried

  • A comma-separated-value for {group-id}, but it gives error

    Invalid value {xxx1,xxx2,xxx3} in key {id}

  • A / separated value for {group-id} gives error

    Unknown field {xxx2} in resource {Group}

Kindly guide what I am missing here, as the documentation also suggests one or more groups and it is a genuine use-case.


回答1:


https://api.linkedin.com/v1/people/~/group-memberships:(group:(id,name),…

You should be able to ask for all additional group fields you want directly in this call, by extending the field list after group:(… accordingly:

https://api.linkedin.com/v1/people/~/group-memberships:(group:(id,name,
small-lo‌​go-url,large-logo-url),…


来源:https://stackoverflow.com/questions/21901268/linkedin-groups-api-getting-group-logo-for-multiple-groups-in-a-single-api-req

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!