Pending invitation API endpoint
An invitation by email to someone without an account yet, for a role on a group, project or personal attribute; it takes effect when they sign up.
Table of contents
Endpoints
- Private portal:
https://www.brainstem.org/api/private/users/pendinginvitation/(needs a token; one record: append<id>/) - Public portal: not available
- Response keys:
pending_invitation(detail, create, update),pending_invitations(list) - Permissions: see the permissions page
- Uniqueness:
tokenunique across BrainSTEM
Fields
[required] fields must be sent on create; [read-only] fields are returned but cannot be set. A nestable relation can be traversed in filters (filter{field.other}) and sideloaded with include[]=field.*; other relations can only be compared with ids (filter{field}=<id>). See the query syntax.
| Field | Description |
|---|---|
id | UUID string [read-only] |
email | string [required]; max 254 characters. Email address of the invitee (normalized to lowercase) |
resource_type | computed [read-only] |
invited_to | computed [read-only] |
can_change | boolean [read-only] |
manage | boolean [read-only] |
own | boolean [read-only] |
expires_at | datetime [read-only] |
is_expired | computed [read-only] |
is_accepted | boolean [read-only] |
List
- Allowed portals: private
- Request method: GET
- URL:
https://www.brainstem.org/api/private/users/pendinginvitation/ - Responses:
200OK;401Not authenticated;403Not allowed
Use example (Python API tool)
resp = client.load('pendinginvitation', load_all=True)
records = resp['pending_invitations']
Use example (MATLAB API tool)
resp = client.load('pendinginvitation', 'load_all', true);
records = resp.pending_invitations;
Response example
{
"pending_invitations": [
{
"id": "<id>",
"email": "",
"resource_type": null,
"invited_to": null,
"can_change": true,
"manage": true,
"own": true,
"expires_at": "2024-03-22T10:30:00Z",
"is_expired": null,
"is_accepted": true
}
],
"meta": {
"page": 1,
"per_page": 100,
"total_results": 1,
"total_pages": 1
}
}
Add
- Allowed portals: private
- Request method: POST
- URL:
https://www.brainstem.org/api/private/users/pendinginvitation/ - Data: JSON object with at least the required fields
- Responses:
201Created;400Bad request (validation errors per field);403Not allowed
Use example (Python API tool)
resp = client.save('pendinginvitation', data={"email": "<email>"})
record = resp.json()['pending_invitation']
Use example (MATLAB API tool)
created = client.save(struct('email', '<email>'), 'pendinginvitation');
record = created.pending_invitation;
Detail
- Allowed portals: private
- Request method: GET
- URL:
https://www.brainstem.org/api/private/users/pendinginvitation/<id>/ - Responses:
200OK;403Not allowed;404Not found
Use example (Python API tool)
resp = client.load('pendinginvitation', id='<id>')
record = resp.json()['pending_invitation']
Use example (MATLAB API tool)
out = client.load('pendinginvitation', 'id', '<id>');
record = out.pending_invitation;
Response example
{
"pending_invitation": {
"id": "<id>",
"email": "",
"resource_type": null,
"invited_to": null,
"can_change": true,
"manage": true,
"own": true,
"expires_at": "2024-03-22T10:30:00Z",
"is_expired": null,
"is_accepted": true
}
}
Change
- Allowed portals: private
- Request method: PATCH
- URL:
https://www.brainstem.org/api/private/users/pendinginvitation/<id>/ - Data: JSON object with the fields to change. Lists (
projects,tags, …) and JSON payloads (details, coordinates) are replaced as a whole: read the record first and send the full list or object. - Responses:
200OK;400Bad request;403Not allowed;404Not found
Use example (Python API tool)
resp = client.save('pendinginvitation', id='<id>', data={"email": "new value"})
Use example (MATLAB API tool)
client.save(struct('id', '<id>', 'email', 'new value'), 'pendinginvitation', 'method', 'patch');
Delete
- Allowed portals: private
- Request method: DELETE
- URL:
https://www.brainstem.org/api/private/users/pendinginvitation/<id>/ - Responses:
204Deleted;400Still referenced by other records;403Not allowed;404Not found
Use example (Python API tool)
resp = client.delete('pendinginvitation', id='<id>')
Use example (MATLAB API tool)
client.delete('<id>', 'pendinginvitation');
Custom actions
| Action | Request |
|---|---|
resend | POST /api/private/users/pendinginvitation/<id>/resend/ |