Group memberships

GET /api/group_memberships
get a list of groups that the current user is a member of

Also see Groups#show.

Success Response Code: 200

Response Fields

group_memberships array of group membership entries Array<GroupMembership>
group_memberships[group] see Groups#show for details Group
group_memberships[role] user's role ["Admin", "Member", "External Contributor"]
group_memberships[role_key] key value of user's role ["admin", "member"]

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/group_memberships.json

Examples

GET 
200
{
  "group_memberships": [
    {
      "group": {
        "id": 19,
        "name": "ec&grøup1",
        "html_name": "ec&amp;grøup1",
        "url": "https://socialcast.socialcast.test/groups/19-ecgr%C3%B8up1",
        "type": "Group",
        "avatars": {
          "is_system_default": true,
          "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square16-de52f6166f708e54b1b832ef06f92e409ae6b09976b4afc3dddbec820123214e.png",
          "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square30-c3483c74bd99384e67bb1c52a48b68e5e5ff04286e3abdbff3a228ee6f40d08b.png",
          "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square45-a31ef7e33bb699a3663623cd7c8244144c7779f6fb34757b1247bb720addbc32.png",
          "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square70-1886d205945147e3e2a37feb87db68bf29603fc508a049c5defa65a0c79e86cd.png",
          "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square140-3f77aeb71272a1df5c7c0e3a0141e91358b3654f9ff918f4974b77e230cab10e.png"
        },
        "username": "ecgrøup1",
        "groupname": "ecgrøup1",
        "private": true,
        "external_contributor": true,
        "chat_enabled": false,
        "post_enabled": true,
        "activity_url": "https://socialcast.socialcast.test/groups/19-ecgr%C3%B8up1/messages_activity",
        "admin_ids": [
          35
        ],
        "description": null,
        "state": "active",
        "permission": "external_contributor",
        "group_type": "standard",
        "member_count": 1,
        "role_key": "admin",
        "can_request_membership": false,
        "can_cancel_membership_request": false,
        "can_join": false,
        "can_leave": false,
        "can_administer": true,
        "chat_stream_id": null,
        "post_stream_id": 248
      },
      "role": "Admin",
      "role_key": "admin"
    },
    {
      "group": {
        "id": 16,
        "name": "privatetest&grøup6",
        "html_name": "privatetest&amp;grøup6",
        "url": "https://socialcast.socialcast.test/groups/16-privatetestgr%C3%B8up6",
        "type": "Group",
        "avatars": {
          "is_system_default": true,
          "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square16-de52f6166f708e54b1b832ef06f92e409ae6b09976b4afc3dddbec820123214e.png",
          "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square30-c3483c74bd99384e67bb1c52a48b68e5e5ff04286e3abdbff3a228ee6f40d08b.png",
          "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square45-a31ef7e33bb699a3663623cd7c8244144c7779f6fb34757b1247bb720addbc32.png",
          "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square70-1886d205945147e3e2a37feb87db68bf29603fc508a049c5defa65a0c79e86cd.png",
          "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square140-3f77aeb71272a1df5c7c0e3a0141e91358b3654f9ff918f4974b77e230cab10e.png"
        },
        "username": "privatetestgrøup6",
        "groupname": "privatetestgrøup6",
        "private": true,
        "external_contributor": false,
        "chat_enabled": false,
        "post_enabled": true,
        "activity_url": "https://socialcast.socialcast.test/groups/16-privatetestgr%C3%B8up6/messages_activity",
        "admin_ids": [
          35
        ],
        "description": null,
        "state": "active",
        "permission": "private",
        "group_type": "standard",
        "member_count": 1,
        "role_key": "admin",
        "can_request_membership": false,
        "can_cancel_membership_request": false,
        "can_join": false,
        "can_leave": false,
        "can_administer": true,
        "chat_stream_id": null,
        "post_stream_id": 244
      },
      "role": "Admin",
      "role_key": "admin"
    },
    {
      "group": {
        "id": 18,
        "name": "test&grøup10",
        "html_name": "test&amp;grøup10",
        "url": "https://socialcast.socialcast.test/groups/18-testgr%C3%B8up10",
        "type": "Group",
        "avatars": {
          "is_system_default": true,
          "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square16-de52f6166f708e54b1b832ef06f92e409ae6b09976b4afc3dddbec820123214e.png",
          "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square30-c3483c74bd99384e67bb1c52a48b68e5e5ff04286e3abdbff3a228ee6f40d08b.png",
          "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square45-a31ef7e33bb699a3663623cd7c8244144c7779f6fb34757b1247bb720addbc32.png",
          "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square70-1886d205945147e3e2a37feb87db68bf29603fc508a049c5defa65a0c79e86cd.png",
          "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square140-3f77aeb71272a1df5c7c0e3a0141e91358b3654f9ff918f4974b77e230cab10e.png"
        },
        "username": "testgrøup10",
        "groupname": "testgrøup10",
        "private": false,
        "external_contributor": false,
        "chat_enabled": true,
        "post_enabled": true,
        "activity_url": "https://socialcast.socialcast.test/groups/18-testgr%C3%B8up10/messages_activity",
        "admin_ids": [
          35
        ],
        "description": null,
        "state": "active",
        "permission": "public",
        "group_type": "standard",
        "member_count": 1,
        "role_key": "admin",
        "can_request_membership": false,
        "can_cancel_membership_request": false,
        "can_join": false,
        "can_leave": false,
        "can_administer": true,
        "chat_stream_id": 247,
        "post_stream_id": 246,
        "chats_last_viewed_at": 0,
        "unread_chats_count": 0
      },
      "role": "Admin",
      "role_key": "admin"
    },
    {
      "group": {
        "id": 13,
        "name": "test&grøup7",
        "html_name": "test&amp;grøup7",
        "url": "https://socialcast.socialcast.test/groups/13-testgr%C3%B8up7",
        "type": "Group",
        "avatars": {
          "is_system_default": true,
          "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square16-de52f6166f708e54b1b832ef06f92e409ae6b09976b4afc3dddbec820123214e.png",
          "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square30-c3483c74bd99384e67bb1c52a48b68e5e5ff04286e3abdbff3a228ee6f40d08b.png",
          "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square45-a31ef7e33bb699a3663623cd7c8244144c7779f6fb34757b1247bb720addbc32.png",
          "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square70-1886d205945147e3e2a37feb87db68bf29603fc508a049c5defa65a0c79e86cd.png",
          "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square140-3f77aeb71272a1df5c7c0e3a0141e91358b3654f9ff918f4974b77e230cab10e.png"
        },
        "username": "testgrøup7",
        "groupname": "testgrøup7",
        "private": false,
        "external_contributor": false,
        "chat_enabled": false,
        "post_enabled": true,
        "activity_url": "https://socialcast.socialcast.test/groups/13-testgr%C3%B8up7/messages_activity",
        "admin_ids": [
          35,
          36
        ],
        "description": null,
        "state": "active",
        "permission": "public",
        "group_type": "standard",
        "member_count": 2,
        "role_key": "admin",
        "can_request_membership": false,
        "can_cancel_membership_request": false,
        "can_join": false,
        "can_leave": true,
        "can_administer": true,
        "chat_stream_id": null,
        "post_stream_id": 240
      },
      "role": "Admin",
      "role_key": "admin"
    },
    {
      "group": {
        "id": 14,
        "name": "test&grøup8",
        "html_name": "test&amp;grøup8",
        "url": "https://socialcast.socialcast.test/groups/14-testgr%C3%B8up8",
        "type": "Group",
        "avatars": {
          "is_system_default": true,
          "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square16-de52f6166f708e54b1b832ef06f92e409ae6b09976b4afc3dddbec820123214e.png",
          "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square30-c3483c74bd99384e67bb1c52a48b68e5e5ff04286e3abdbff3a228ee6f40d08b.png",
          "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square45-a31ef7e33bb699a3663623cd7c8244144c7779f6fb34757b1247bb720addbc32.png",
          "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square70-1886d205945147e3e2a37feb87db68bf29603fc508a049c5defa65a0c79e86cd.png",
          "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_group_square140-3f77aeb71272a1df5c7c0e3a0141e91358b3654f9ff918f4974b77e230cab10e.png"
        },
        "username": "testgrøup8",
        "groupname": "testgrøup8",
        "private": false,
        "external_contributor": false,
        "chat_enabled": false,
        "post_enabled": true,
        "activity_url": "https://socialcast.socialcast.test/groups/14-testgr%C3%B8up8/messages_activity",
        "admin_ids": [
          30
        ],
        "description": null,
        "state": "active",
        "permission": "public",
        "group_type": "standard",
        "member_count": 2,
        "role_key": "member",
        "can_request_membership": false,
        "can_cancel_membership_request": false,
        "can_join": false,
        "can_leave": true,
        "can_administer": false,
        "chat_stream_id": null,
        "post_stream_id": 241
      },
      "role": "Member",
      "role_key": "member"
    }
  ]
}

GET /api/groups/:group_id/memberships
get a list of membership records for a group that the user has access to

Success Response Code: 200

Params

Param name Description
group_id
required

id / name of the group


Value: Must be a String
separate_roles
optional

list admins before members (default=false)


Value: Must be one of: <code>true</code>, <code>false</code>.
page
optional

page number to view (default=1)


Value: Must be a Integer
per_page
optional

number of users to be returned per page (default=20, max=500)


Value: Must be a Integer

Response Fields

group_memberships group memberships Array<GroupMembership>
id group membership object id Integer
user_id user id for the member Integer
role user's role ["Admin", "Member", "External Contributor"]
role_key key value of user's role ["admin", "member"]

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships.json

Examples

GET 
200
{
  "group_memberships": [
    {
      "id": 32,
      "user_id": 30,
      "role": "Member",
      "role_key": "member"
    },
    {
      "id": 22,
      "user_id": 35,
      "role": "Admin",
      "role_key": "admin"
    }
  ]
}
GET 
200
{
  "group_memberships": [
    {
      "id": 22,
      "user_id": 35,
      "role": "Admin",
      "role_key": "admin"
    },
    {
      "id": 33,
      "user_id": 30,
      "role": "Member",
      "role_key": "member"
    }
  ]
}

POST /api/groups/:group_id/memberships
add a member to a group (group admin privilege required)

Success Response Code: 201

Params

Param name Description
group_id
required

id / name of group


Value: Must be a String
group_membership
optional

Value: Must be a Hash
group_membership[user_id]
optional

user id


Value: Must be a Integer
group_membership[role]
optional

user's role in the group


Value: Must be one of: <code>admin</code>, <code>member</code>.

Response Fields

id group membership object id Integer
user_id user id for the member Integer
role user's role ["Admin", "Member", "External Contributor"]
role_key key value of user's role ["admin", "member"]

Example Curl Commands

curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships.json -H"Content-Type: application/json" -d'{"group_membership":{"user_id":21,"role":"member"}}'

Examples

POST 
{
  "group_membership": {
    "role": "Member",
    "user_id": "30"
  }
}
201
{
  "group_membership": {
    "id": 34,
    "user_id": 30,
    "role": "Member",
    "role_key": "member"
  }
}

POST /api/groups/:group_id/memberships/add_members
add or invite one or more members to a group (group admin privilege required)

Success Response Code: 201

Params

Param name Description
group_id
required

id / name of group


Value: Must be a String
group_memberships
optional

Value: Must be an Array of nested elements
group_memberships[user_id]
optional

user id to add to the group (required if email is not provided)


Value: Must be a Integer
group_memberships[email]
optional

email address of the user to add to the group (required if user_id is not provided; supersedes user_id)


Value: Must be a String
group_memberships[role]
optional

user's role in the group


Value: Must be one of: <code>admin</code>, <code>member</code>.
group_memberships[invite]
optional

create invite for email address if the user is not already a community member (requires email)


Value: Must be one of: <code>true</code>, <code>false</code>.

Response Fields

group_memberships array of group memberships Array<GroupMembership>
group_membership[id] group membership object id or null if not created Integer
group_membership[user_id] user id for the member Integer
group_membership[role] user's role ["Admin", "Member", "External Contributor"]
group_membership[role_key] key value of user's role ["admin", "member"]
group_membership[errors] errors for requested group membership or invite Array<String>
group_membership[invite] email address of group invite, if invite attempted String

Example Curl Commands

curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships/add_members.json -H"Content-Type: application/json" -d'{"group_memberships":[{"user_id":21,"role":"member"},{"user_id":22,"role":"admin"}]}'
curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships/add_members.json -H"Content-Type: application/json" -d'{"group_memberships":[{"email":"amanda@socialcast.com","role":"member"},{"user_id":22,"role":"admin"}]}'
curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships/add_members.json -H"Content-Type: application/json" -d'{"group_memberships":[{"email":"newuser@socialcast.com","role":"member","invite":true},{"user_id":22,"role":"admin"}]}'

Examples

POST 
{
  "group_memberships": [
    {
      "role": "Member",
      "user_id": "30"
    }
  ]
}
201
{
  "group_memberships": [
    {
      "id": 35,
      "user_id": 30,
      "role": "Member",
      "role_key": "member"
    }
  ]
}
POST 
{
  "group_memberships": [
    {
      "role": "Member",
      "user_id": "30"
    },
    {
      "role": "Admin",
      "user_id": "32"
    }
  ]
}
201
{
  "group_memberships": [
    {
      "id": 36,
      "user_id": 30,
      "role": "Member",
      "role_key": "member"
    },
    {
      "id": 37,
      "user_id": 32,
      "role": "Admin",
      "role_key": "admin"
    }
  ]
}

PUT /api/groups/:group_id/memberships/:membership_id
change a member's roles in a group (group admin privileges required)

Success Response Code: 200

Params

Param name Description
membership_id
optional

group membership is determined by membership_id or user_id inside the group_membership hash.


Value: Must be a Integer
group_id
required

id / name of group


Value: Must be a String
group_membership
optional

Value: Must be a Hash
group_membership[user_id]
optional

user id


Value: Must be a Integer
group_membership[role]
optional

user's role in the group


Value: Must be one of: <code>admin</code>, <code>member</code>.

Response Fields

id group membership object id Integer
user_id user id for the member Integer
role user's role ["Admin", "Member", "External Contributor"]
role_key key value of user's role ["admin", "member"]

Example Curl Commands

curl -X PUT -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships/30.json -H"Content-Type: application/json" -d'{"group_membership":{"role":"Admin"}}'
curl -X PUT -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships -H"Content-Type: application/json" -d'{"group_membership":{"id":30,"role":"Admin"}}'
curl -X PUT -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships -H"Content-Type: application/json" -d'{"group_membership":{"user_id":26,"role":"Admin"}}'

Examples

PUT 
{
  "group_membership": {
    "role": "Member",
    "user_id": "30"
  }
}
200
{
  "group_membership": {
    "id": 38,
    "user_id": 30,
    "role": "Member",
    "role_key": "member"
  }
}

DELETE /api/groups/:group_id/memberships
remove member from a group (group admin privileges required)

Success Response Code: 204

Params

Param name Description
group_id
required

id / name of group


Value: Must be a String
membership_id
optional

group membership is determined by membership_id or user_id inside the group_membership hash


Value: Must be a Integer
group_membership
optional

Value: Must be a Hash
group_membership[user_id]
optional

user id


Value: Must be a Integer

Example Curl Commands

curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships/30.json
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships -H"Content-Type: application/json" -d'{"group_membership":{"id":30}}'
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/hrteam/memberships -H"Content-Type: application/json" -d'{"group_membership":{"user_id":26}}'

Examples

DELETE 
{
  "group_membership": {
    "user_id": "30"
  }
}
204