foliolib.folio.api.users.Groups
- class foliolib.folio.api.users.Groups(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApimod-users Groups API
This documents the API calls that can be made to query and manage user groups of the system
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_group(groupId)Delete group item with given {groupId}
get_group(groupId)Retrieve group item with given {groupId}
get_groups(**kwargs)Return a list of groups
modify_group(groupId, group)Update group item with given {groupId}
set_group(group)Create a group
- delete_group(groupId: str)
Delete group item with given {groupId}
DELETE /groups/{groupId}- Parameters
groupId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_group(groupId: str)
Retrieve group item with given {groupId}
GET /groups/{groupId}- Parameters
groupId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Group Schema", "description": "A user group", "type": "object", "properties": { "group": { "description": "The unique name of this group", "type": "string" }, "desc": { "description": "An explanation of this group", "type": "string" }, "id": { "description": "A UUID identifying this group", "type": "string" }, "expirationOffsetInDays": { "description": "The default period in days after which a newly created user that belongs to this group will expire", "type": "integer" }, "source": { "description": "Origin of the group record, i.e. 'System' or 'User'", "type": "string" }, "metadata": { "$ref": "raml-util/schemas/metadata.schema", "readonly": true } }, "required": [ "group" ] }
- get_groups(**kwargs)
Return a list of groups
GET /groups- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
query (str) –
A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://dev.folio.org/reference/glossary#cql)) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
group=*grad*
offset (int) –
(default=0) Skip over a number of elements by specifying an offset value for the query
Example
0
limit (int) –
(default=10) Limit the number of elements returned in the response
Example
10
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Collection of user groups", "properties": { "usergroups": { "description": "List of user group items", "id": "groups", "type": "array", "items": { "type": "object", "$ref": "usergroup.json" } }, "totalRecords": { "type": "integer" } } }
- modify_group(groupId: str, group: dict)
Update group item with given {groupId}
PUT /groups/{groupId}- Parameters
groupId (str) –
group (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Group Schema", "description": "A user group", "type": "object", "properties": { "group": { "description": "The unique name of this group", "type": "string" }, "desc": { "description": "An explanation of this group", "type": "string" }, "id": { "description": "A UUID identifying this group", "type": "string" }, "expirationOffsetInDays": { "description": "The default period in days after which a newly created user that belongs to this group will expire", "type": "integer" }, "source": { "description": "Origin of the group record, i.e. 'System' or 'User'", "type": "string" }, "metadata": { "$ref": "raml-util/schemas/metadata.schema", "readonly": true } }, "required": [ "group" ] }
- set_group(group: dict)
Create a group
POST /groups- Parameters
group (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Headers
Location - URI to the created group item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Group Schema", "description": "A user group", "type": "object", "properties": { "group": { "description": "The unique name of this group", "type": "string" }, "desc": { "description": "An explanation of this group", "type": "string" }, "id": { "description": "A UUID identifying this group", "type": "string" }, "expirationOffsetInDays": { "description": "The default period in days after which a newly created user that belongs to this group will expire", "type": "integer" }, "source": { "description": "Origin of the group record, i.e. 'System' or 'User'", "type": "string" }, "metadata": { "$ref": "raml-util/schemas/metadata.schema", "readonly": true } }, "required": [ "group" ] }