Memberships
Create, update, delete, and query the available Memberships in Box.
Table Specific Information
Memberships are the relations between a User and a Group.
Select
To select from the Memberships table you need to specify an Id, a GroupId or a UserId.
SELECT * FROM Memberships WHERE Id = '123'
If you're authenticated as an administrator with user impersonation permissions, you can query memberships from multiple user accounts:
SELECT * FROM Memberships WHERE AsUserId IN (SELECT Id FROM Users)
Note: User impersonation has the following limitations:
- The authenticated user cannot be impersonated unless that user is a service account.
- If the authenticated user is a standard user account, they can only query memberships associated with their account.
- Memberships shared with multiple users are only returned for one of the users.
Insert
To insert into Memberships you need to connect a Group (GroupId) with a User (UserId).
INSERT INTO Memberships (GroupId, UserId) VALUES (1001, 123)
Update
Only the role of the Member can be updated. The default role is 'member' with option for 'admin'
UPDATE Memberships SET Role = 'admin' WHERE Id = '100'
Delete
Memberships can be deleted by providing an Id and issuing a DELETE statement.
DELETE FROM Memberships WHERE Id = '100'
Columns
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Id of the membership. |
Role | String | False |
The role of the user that is in this membership. |
CreatedAt | Datetime | True |
The date the membership was created at, you need to specify an Id to recieve this column. |
ModifiedAt | Datetime | True |
The date the membership was modified at, you need to specify an Id to recieve this column. |
UserName | String | True |
The name of the user of the membership. |
UserLogin | String | True |
The login of the user of the membership. |
UserId | String | False |
The id of the user of the membership. |
GroupName | String | False |
The group name of the membership. |
GroupId | String | False |
The group of the membership. |
AsUserId | String | False |
The Id of the user you want to impersonate. Only works with Admin, Co-Admin and Service Accounts. |