Four new endpoints have been added in the JSON API User Plus plugin for BuddyPress Groups component REST JSON API groups_get_avatar, groups_upload_avatar, groups_get_cover, groups_upload_cover.
These endpoints have added missing features for the BuddyPress Groups component via REST API and now Groups endpoints can be used for mobile app to manage avatars and cover. Both Update and Delete group meta endpoints have admin access check. Get endpoint has check that only members or admins can access the data. Only public groups are meta is available fro all users.
Here are the new four restful endpoints for BuddyPress Groups avatar and cover image:
1. groups_get_avatar
Get avatar of the group.
Parameters
- key – get API key from Settings > User Plus
- group_id required. (int) ID of the group
- cookie – required. admin of the group.
- type – Size of the avatar ‘thumb’ or ‘full’. ‘thumb’ by default.
- size – width and height of the avatar. 50 by default.
Return
Returns false on failure. On successful uploading, returns url of the full avatar and its thumb.
2. groups_upload_avatar
Upload avatar of the group.
Parameters
- key – get API key from Settings > User Plus
- group_id required. (int) ID of the group
- cookie – required. admin of the group.
- avatar required. File type variable with image.
- full – optional. Default BuddyPress full 300px
- thumb – optional. Default BuddyPress thumb 50px.
Return
Returns false on failure. On successful uploading, returns url of the full avatar and its thumb.
3. groups_get_cover
Get cover image of the group.
Parameters
- key – get API key from Settings > User Plus
- group_id required. (int) ID of the group
Return
Returns url of the cover.
4. groups_upload_cover
Upload cover image of the group.
Parameters
- key – get API key from Settings > User Plus
- group_id required. (int) ID of the group
- cookie – required. admin of the group.
- cover required. File type variable with image.
Return
Returns false on failure. On successful uploading, returns url of the cover.