foliolib.folio.api.usersKeycloak.Userskeycloak
- class foliolib.folio.api.usersKeycloak.Userskeycloak(tenant: str)
Bases:
foliolib.folio.FolioApiUsers Keycloak API
Users Keycloak API
Base class of the Folio API
- Parameters
tenant (str) – Tenant id
Methods
createuser(user, **kwargs)Create a new user
deletemigration(id_)Delete a user migration
deleteuser(id_)Delete user with given id
deleteusers(**kwargs)Delete a collection of users selected by a CQL query; | this doesn't delete proxyFor records that reference them
generatepasswordresetlink(generateLinkRequest)Generate and send password reset link
getmigration(id_)Retrieve a user migration
getmigrations(**kwargs)Retrieve a list of user migrations
getuser(id_)Get a single user
getuserbyselfreference(**kwargs)Get a user by self reference
getusers(**kwargs)Retrieve a list of users
Migrate users from mod-users to Keycloak
passwordreset(passwordReset)POST /users-keycloak/password-reset/resetrecoverforgottenusername(identifier)called when a user has forgotten a username
resetforgottenpassword(identifier)called when a user has forgotten a password
updateuser(user, id_)Update user with given id
Validates password reset link
- createuser(user, **kwargs)
Create a new user
POST /users-keycloak/users- Parameters
user (dict) – See Schema below.
- Keyword Arguments
keycloakOnly (bool) – Create auth user only during user creation (default: False)
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestUnprocessableEntity – Validation errors
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Schema", "description": "A user", "type": "object", "properties": { "username": { "description": "A unique name belonging to a user. Typically used for login", "type": "string" }, "id": { "description": "A globally unique (UUID) identifier for the user", "type": "string", "format": "uuid" }, "externalSystemId": { "description": "A unique ID that corresponds to an external authority", "type": "string" }, "barcode": { "description": "The unique library barcode for this user", "type": "string" }, "active": { "description": "A flag to determine if the user's account is effective and not expired. The tenant configuration can require the user to be active for login. Active is different from the loan patron block", "type": "boolean" }, "type": { "description": "The class of user like staff or patron; this is different from patronGroup", "type": "string" }, "patronGroup": { "description": "A UUID corresponding to the group the user belongs to, see /groups API, example groups are undergraduate and faculty; loan rules, patron blocks, fees/fines and expiration days can use the patron group", "type": "string", "format": "uuid" }, "departments": { "description": "A list of UUIDs corresponding to the departments the user belongs to, see /departments API", "type": "array", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "meta": { "description": "Deprecated", "type": "object" }, "proxyFor": { "description": "Deprecated", "type": "array", "items": { "type": "string" } }, "personal": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Personal Schema", "description": "Personal information about the user", "type": "object", "properties": { "lastName": { "description": "The user's surname", "type": "string" }, "firstName": { "description": "The user's given name", "type": "string" }, "middleName": { "description": "The user's middle name (if any)", "type": "string" }, "preferredFirstName": { "description": "The user's preferred name", "type": "string" }, "email": { "description": "The user's email address", "type": "string" }, "phone": { "description": "The user's primary phone number", "type": "string" }, "mobilePhone": { "description": "The user's mobile phone number", "type": "string" }, "dateOfBirth": { "type": "string", "description": "The user's birth date", "format": "date-time" }, "addresses": { "description": "Physical addresses associated with the user", "type": "array", "minItems": 0, "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Address Schema", "description": "Address information", "type": "object", "properties": { "id": { "description": "A unique id for this address", "type": "string" }, "countryId": { "description": "The country code for this address", "type": "string" }, "addressLine1": { "description": "Address, Line 1", "type": "string" }, "addressLine2": { "description": "Address, Line 2", "type": "string" }, "city": { "description": "City name", "type": "string" }, "region": { "description": "Region", "type": "string" }, "postalCode": { "description": "Postal Code", "type": "string" }, "addressTypeId": { "description": "A UUID that corresponds with an address type object", "type": "string", "format": "uuid" }, "primaryAddress": { "description": "Is this the user's primary address?", "type": "boolean" } }, "required": [ "addressTypeId" ], "additionalProperties": false } }, "preferredContactTypeId": { "description": "Id of user's preferred contact type like Email, Mail or Text Message, see /addresstypes API", "type": "string" } }, "additionalProperties": false, "required": [ "lastName" ] }, "enrollmentDate": { "description": "The date in which the user joined the organization", "type": "string", "format": "date-time" }, "expirationDate": { "description": "The date for when the user becomes inactive", "type": "string", "format": "date-time" }, "createdDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "updatedDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] }, "tags": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "tags", "description": "List of simple tags that can be added to an object", "type": "object", "properties": { "tagList": { "description": "List of tags", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }, "customFields": { "description": "Object that contains custom field", "type": "object", "additionalProperties": true } }, "additionalProperties": false }
- deletemigration(id_)
Delete a user migration
DELETE /users-keycloak/migrations/{id}- Returns
See Schema below.
- Return type
dict
Schema
{ "type": "string" }
- deleteuser(id_)
Delete user with given id
DELETE /users-keycloak/users/{id}- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestNotFound – Error response if entity is not found by id (in json format)
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "type": "string" }
- deleteusers(**kwargs)
Delete a collection of users selected by a CQL query; | this doesn’t delete proxyFor records that reference them
DELETE /users-keycloak/users- Keyword Arguments
query (str) – A CQL query string with search conditions.
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "type": "string" }
- generatepasswordresetlink(generateLinkRequest)
Generate and send password reset link
POST /users-keycloak/password-reset/link- Parameters
generateLinkRequest (dict) – See Schema below.
- Returns
See Schema below.
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Request to generate and send reset password link", "properties": { "userId": { "type": "string", "format": "uuid", "description": "Id of user to whom a reset password link is sent" } }, "required": [ "userId" ] }
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Response for reset password link generation", "properties": { "link": { "type": "string", "description": "Link for resetting password" } }, "additionalProperties": false }
- getmigration(id_)
Retrieve a user migration
GET /users-keycloak/migrations/{id}- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "userMigrationJob.json", "title": "User Migration Job Schema", "description": "A user migration job entity for tracking migration's progress", "type": "object", "properties": { "id": { "description": "An migration job identifier", "type": "string", "format": "uuid" }, "status": { "$schema": "http://json-schema.org/draft-04/schema#", "id": "types/userMigrationJobStatus.json", "title": "User Migration Job Status Schema", "description": "An user migration job status", "type": "string", "enum": [ "in_progress", "failed", "finished" ] }, "totalRecords": { "type": "integer" }, "startedAt": { "description": "A user migration job start timestamp", "type": "string", "format": "date-time" }, "finishedAt": { "description": "A user migration job end timestamp", "type": "string", "format": "date-time" } } }
- getmigrations(**kwargs)
Retrieve a list of user migrations
GET /users-keycloak/migrations- Keyword Arguments
query (str) – A CQL query string with search conditions.
offset (int) – Skip over a number of elements by specifying an offset value for the query. (minimum: 0, default: 0)
limit (int) – Limit the number of elements returned in the response. (minimum: 0, maximum: 500, default: 10)
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "userMigrationJobs.json", "title": "List of User Migration Jobs Schema", "description": "A list of user migration job entities", "type": "object", "properties": { "migrations": { "description": "List of Migration Jobs", "type": "array", "id": "migrations", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "id": "userMigrationJob.json", "title": "User Migration Job Schema", "description": "A user migration job entity for tracking migration's progress", "type": "object", "properties": { "id": { "description": "An migration job identifier", "type": "string", "format": "uuid" }, "status": { "$schema": "http://json-schema.org/draft-04/schema#", "id": "types/userMigrationJobStatus.json", "title": "User Migration Job Status Schema", "description": "An user migration job status", "type": "string", "enum": [ "in_progress", "failed", "finished" ] }, "totalRecords": { "type": "integer" }, "startedAt": { "description": "A user migration job start timestamp", "type": "string", "format": "date-time" }, "finishedAt": { "description": "A user migration job end timestamp", "type": "string", "format": "date-time" } } } }, "totalRecords": { "type": "integer" } } }
- getuser(id_)
Get a single user
GET /users-keycloak/users/{id}- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestNotFound – Error response if entity is not found by id (in json format)
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Schema", "description": "A user", "type": "object", "properties": { "username": { "description": "A unique name belonging to a user. Typically used for login", "type": "string" }, "id": { "description": "A globally unique (UUID) identifier for the user", "type": "string", "format": "uuid" }, "externalSystemId": { "description": "A unique ID that corresponds to an external authority", "type": "string" }, "barcode": { "description": "The unique library barcode for this user", "type": "string" }, "active": { "description": "A flag to determine if the user's account is effective and not expired. The tenant configuration can require the user to be active for login. Active is different from the loan patron block", "type": "boolean" }, "type": { "description": "The class of user like staff or patron; this is different from patronGroup", "type": "string" }, "patronGroup": { "description": "A UUID corresponding to the group the user belongs to, see /groups API, example groups are undergraduate and faculty; loan rules, patron blocks, fees/fines and expiration days can use the patron group", "type": "string", "format": "uuid" }, "departments": { "description": "A list of UUIDs corresponding to the departments the user belongs to, see /departments API", "type": "array", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "meta": { "description": "Deprecated", "type": "object" }, "proxyFor": { "description": "Deprecated", "type": "array", "items": { "type": "string" } }, "personal": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Personal Schema", "description": "Personal information about the user", "type": "object", "properties": { "lastName": { "description": "The user's surname", "type": "string" }, "firstName": { "description": "The user's given name", "type": "string" }, "middleName": { "description": "The user's middle name (if any)", "type": "string" }, "preferredFirstName": { "description": "The user's preferred name", "type": "string" }, "email": { "description": "The user's email address", "type": "string" }, "phone": { "description": "The user's primary phone number", "type": "string" }, "mobilePhone": { "description": "The user's mobile phone number", "type": "string" }, "dateOfBirth": { "type": "string", "description": "The user's birth date", "format": "date-time" }, "addresses": { "description": "Physical addresses associated with the user", "type": "array", "minItems": 0, "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Address Schema", "description": "Address information", "type": "object", "properties": { "id": { "description": "A unique id for this address", "type": "string" }, "countryId": { "description": "The country code for this address", "type": "string" }, "addressLine1": { "description": "Address, Line 1", "type": "string" }, "addressLine2": { "description": "Address, Line 2", "type": "string" }, "city": { "description": "City name", "type": "string" }, "region": { "description": "Region", "type": "string" }, "postalCode": { "description": "Postal Code", "type": "string" }, "addressTypeId": { "description": "A UUID that corresponds with an address type object", "type": "string", "format": "uuid" }, "primaryAddress": { "description": "Is this the user's primary address?", "type": "boolean" } }, "required": [ "addressTypeId" ], "additionalProperties": false } }, "preferredContactTypeId": { "description": "Id of user's preferred contact type like Email, Mail or Text Message, see /addresstypes API", "type": "string" } }, "additionalProperties": false, "required": [ "lastName" ] }, "enrollmentDate": { "description": "The date in which the user joined the organization", "type": "string", "format": "date-time" }, "expirationDate": { "description": "The date for when the user becomes inactive", "type": "string", "format": "date-time" }, "createdDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "updatedDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] }, "tags": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "tags", "description": "List of simple tags that can be added to an object", "type": "object", "properties": { "tagList": { "description": "List of tags", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }, "customFields": { "description": "Object that contains custom field", "type": "object", "additionalProperties": true } }, "additionalProperties": false }
- getuserbyselfreference(**kwargs)
Get a user by self reference
GET /users-keycloak/_self- Keyword Arguments
include (list) – Indicates which referenced fields should be populated (de-referenced) by the service (items: ($ref: #/components/schemas/includedField))
expandPermissions (bool) – Whether or not to expand permissions listings (default: False)
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestForbidden – Access denied
OkapiRequestNotFound – Error response if entity is not found by id (in json format)
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Composite user object", "properties": { "user": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Schema", "description": "A user", "type": "object", "properties": { "username": { "description": "A unique name belonging to a user. Typically used for login", "type": "string" }, "id": { "description": "A globally unique (UUID) identifier for the user", "type": "string", "format": "uuid" }, "externalSystemId": { "description": "A unique ID that corresponds to an external authority", "type": "string" }, "barcode": { "description": "The unique library barcode for this user", "type": "string" }, "active": { "description": "A flag to determine if the user's account is effective and not expired. The tenant configuration can require the user to be active for login. Active is different from the loan patron block", "type": "boolean" }, "type": { "description": "The class of user like staff or patron; this is different from patronGroup", "type": "string" }, "patronGroup": { "description": "A UUID corresponding to the group the user belongs to, see /groups API, example groups are undergraduate and faculty; loan rules, patron blocks, fees/fines and expiration days can use the patron group", "type": "string", "format": "uuid" }, "departments": { "description": "A list of UUIDs corresponding to the departments the user belongs to, see /departments API", "type": "array", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "meta": { "description": "Deprecated", "type": "object" }, "proxyFor": { "description": "Deprecated", "type": "array", "items": { "type": "string" } }, "personal": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Personal Schema", "description": "Personal information about the user", "type": "object", "properties": { "lastName": { "description": "The user's surname", "type": "string" }, "firstName": { "description": "The user's given name", "type": "string" }, "middleName": { "description": "The user's middle name (if any)", "type": "string" }, "preferredFirstName": { "description": "The user's preferred name", "type": "string" }, "email": { "description": "The user's email address", "type": "string" }, "phone": { "description": "The user's primary phone number", "type": "string" }, "mobilePhone": { "description": "The user's mobile phone number", "type": "string" }, "dateOfBirth": { "type": "string", "description": "The user's birth date", "format": "date-time" }, "addresses": { "description": "Physical addresses associated with the user", "type": "array", "minItems": 0, "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Address Schema", "description": "Address information", "type": "object", "properties": { "id": { "description": "A unique id for this address", "type": "string" }, "countryId": { "description": "The country code for this address", "type": "string" }, "addressLine1": { "description": "Address, Line 1", "type": "string" }, "addressLine2": { "description": "Address, Line 2", "type": "string" }, "city": { "description": "City name", "type": "string" }, "region": { "description": "Region", "type": "string" }, "postalCode": { "description": "Postal Code", "type": "string" }, "addressTypeId": { "description": "A UUID that corresponds with an address type object", "type": "string", "format": "uuid" }, "primaryAddress": { "description": "Is this the user's primary address?", "type": "boolean" } }, "required": [ "addressTypeId" ], "additionalProperties": false } }, "preferredContactTypeId": { "description": "Id of user's preferred contact type like Email, Mail or Text Message, see /addresstypes API", "type": "string" } }, "additionalProperties": false, "required": [ "lastName" ] }, "enrollmentDate": { "description": "The date in which the user joined the organization", "type": "string", "format": "date-time" }, "expirationDate": { "description": "The date for when the user becomes inactive", "type": "string", "format": "date-time" }, "createdDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "updatedDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] }, "tags": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "tags", "description": "List of simple tags that can be added to an object", "type": "object", "properties": { "tagList": { "description": "List of tags", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }, "customFields": { "description": "Object that contains custom field", "type": "object", "additionalProperties": true } }, "additionalProperties": false }, "patronGroup": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Group Schema", "description": "User group schema", "type": "object", "properties": { "group": { "type": "string", "description": "group" }, "desc": { "type": "string", "description": "description" }, "id": { "type": "string", "description": "id" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] } }, "required": [ "group" ] }, "permissions": { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Permission User Object", "properties": { "id": { "type": "string", "description": "Id" }, "userId": { "type": "string", "description": "User Id" }, "permissions": { "type": "array", "description": "Permissions array", "items": { "type": "string" } }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] } }, "additionalProperties": false }, "proxiesFor": { "type": "array", "description": "Proxies for, array", "id": "proxyFor", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "ProxyFor Schema", "description": "Proxy For Schema", "type": "object", "properties": { "userId": { "type": "string", "description": "User Id" }, "proxyUserId": { "type": "string", "description": "Proxy User Id" }, "id": { "type": "string", "description": "Id" }, "requestForSponsor": { "type": "string", "description": "Request For Sponsor" }, "createdDate": { "type": "string", "format": "date-time", "description": "Created Date" }, "notificationsTo": { "type": "string", "description": "Notifications To" }, "accrueTo": { "type": "string", "description": "Accrue To" }, "status": { "type": "string", "description": "Status" }, "expirationDate": { "type": "string", "format": "date-time", "description": "Expiration Date" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] } }, "additionalProperties": false } }, "servicePointsUser": { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Service points expanded user", "properties": { "id": { "type": "string", "description": "Id" }, "userId": { "type": "string", "description": "User Id" }, "servicePointsIds": { "type": "array", "description": "Service Points Ids", "items": { "type": "string" } }, "servicePoints": { "type": "array", "description": "Service Points", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Service point", "properties": { "id": { "type": "string", "description": "id" }, "name": { "type": "string", "description": "Service point name" }, "code": { "type": "string", "description": "Service point code" }, "discoveryDisplayName": { "type": "string", "description": "Service point discovery name" }, "description": { "type": "string", "description": "Service point description" }, "shelvingLagTime": { "type": "integer", "description": "Shelving lag time" }, "pickupLocation": { "type": "boolean", "description": "Pick up location" }, "staffSlips": { "type": "array", "description": "List of staff slips for this service point", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Staff slip Schema", "description": "Staff slip", "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "The ID of the staff slip" }, "printByDefault": { "type": "boolean", "description": "Whether or not to print the staff slip by default" } }, "additionalProperties": false, "required": [ "id", "printByDefault" ] } }, "locationIds": { "type": "array", "description": "Location Ids", "items": { "type": "string", "format": "uuid" } }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] } }, "required": [ "name", "code", "discoveryDisplayName" ] } }, "defaultServicePointId": { "type": "string", "description": "Default Service Point Id" }, "defaultServicePoint": { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Service point", "properties": { "id": { "type": "string", "description": "id" }, "name": { "type": "string", "description": "Service point name" }, "code": { "type": "string", "description": "Service point code" }, "discoveryDisplayName": { "type": "string", "description": "Service point discovery name" }, "description": { "type": "string", "description": "Service point description" }, "shelvingLagTime": { "type": "integer", "description": "Shelving lag time" }, "pickupLocation": { "type": "boolean", "description": "Pick up location" }, "staffSlips": { "type": "array", "description": "List of staff slips for this service point", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Staff slip Schema", "description": "Staff slip", "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "The ID of the staff slip" }, "printByDefault": { "type": "boolean", "description": "Whether or not to print the staff slip by default" } }, "additionalProperties": false, "required": [ "id", "printByDefault" ] } }, "locationIds": { "type": "array", "description": "Location Ids", "items": { "type": "string", "format": "uuid" } }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] } }, "required": [ "name", "code", "discoveryDisplayName" ] }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] } }, "additionalProperties": false, "required": [ "userId" ] } } }
- getusers(**kwargs)
Retrieve a list of users
GET /users-keycloak/users- Keyword Arguments
query (str) – A CQL query string with search conditions.
offset (int) – Skip over a number of elements by specifying an offset value for the query. (minimum: 0, default: 0)
limit (int) – Limit the number of elements returned in the response. (minimum: 0, maximum: 500, default: 10)
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Collection of users", "properties": { "users": { "description": "List of userdata items", "type": "array", "id": "usersData", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Schema", "description": "A user", "type": "object", "properties": { "username": { "description": "A unique name belonging to a user. Typically used for login", "type": "string" }, "id": { "description": "A globally unique (UUID) identifier for the user", "type": "string", "format": "uuid" }, "externalSystemId": { "description": "A unique ID that corresponds to an external authority", "type": "string" }, "barcode": { "description": "The unique library barcode for this user", "type": "string" }, "active": { "description": "A flag to determine if the user's account is effective and not expired. The tenant configuration can require the user to be active for login. Active is different from the loan patron block", "type": "boolean" }, "type": { "description": "The class of user like staff or patron; this is different from patronGroup", "type": "string" }, "patronGroup": { "description": "A UUID corresponding to the group the user belongs to, see /groups API, example groups are undergraduate and faculty; loan rules, patron blocks, fees/fines and expiration days can use the patron group", "type": "string", "format": "uuid" }, "departments": { "description": "A list of UUIDs corresponding to the departments the user belongs to, see /departments API", "type": "array", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "meta": { "description": "Deprecated", "type": "object" }, "proxyFor": { "description": "Deprecated", "type": "array", "items": { "type": "string" } }, "personal": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Personal Schema", "description": "Personal information about the user", "type": "object", "properties": { "lastName": { "description": "The user's surname", "type": "string" }, "firstName": { "description": "The user's given name", "type": "string" }, "middleName": { "description": "The user's middle name (if any)", "type": "string" }, "preferredFirstName": { "description": "The user's preferred name", "type": "string" }, "email": { "description": "The user's email address", "type": "string" }, "phone": { "description": "The user's primary phone number", "type": "string" }, "mobilePhone": { "description": "The user's mobile phone number", "type": "string" }, "dateOfBirth": { "type": "string", "description": "The user's birth date", "format": "date-time" }, "addresses": { "description": "Physical addresses associated with the user", "type": "array", "minItems": 0, "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Address Schema", "description": "Address information", "type": "object", "properties": { "id": { "description": "A unique id for this address", "type": "string" }, "countryId": { "description": "The country code for this address", "type": "string" }, "addressLine1": { "description": "Address, Line 1", "type": "string" }, "addressLine2": { "description": "Address, Line 2", "type": "string" }, "city": { "description": "City name", "type": "string" }, "region": { "description": "Region", "type": "string" }, "postalCode": { "description": "Postal Code", "type": "string" }, "addressTypeId": { "description": "A UUID that corresponds with an address type object", "type": "string", "format": "uuid" }, "primaryAddress": { "description": "Is this the user's primary address?", "type": "boolean" } }, "required": [ "addressTypeId" ], "additionalProperties": false } }, "preferredContactTypeId": { "description": "Id of user's preferred contact type like Email, Mail or Text Message, see /addresstypes API", "type": "string" } }, "additionalProperties": false, "required": [ "lastName" ] }, "enrollmentDate": { "description": "The date in which the user joined the organization", "type": "string", "format": "date-time" }, "expirationDate": { "description": "The date for when the user becomes inactive", "type": "string", "format": "date-time" }, "createdDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "updatedDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] }, "tags": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "tags", "description": "List of simple tags that can be added to an object", "type": "object", "properties": { "tagList": { "description": "List of tags", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }, "customFields": { "description": "Object that contains custom field", "type": "object", "additionalProperties": true } }, "additionalProperties": false } }, "totalRecords": { "type": "integer" }, "resultInfo": { "$schema": "http://json-schema.org/draft-04/schema#", "description": "Faceting of result sets", "type": "object", "properties": { "totalRecords": { "type": "integer", "description": "Total number of records" }, "responseTime": { "type": "number", "description": "Response time" }, "facets": { "type": "array", "description": "Array of facets", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Facet Schema", "description": "A facet", "type": "object", "properties": { "facetValues": { "type": "array", "description": "Array of facet values", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Facet value Schema", "description": "A facet value", "type": "object", "properties": { "count": { "type": "integer", "description": "Count of facet values" }, "value": { "description": "Value Object" } } } }, "type": { "type": "string", "description": "Type of facet" } }, "additionalProperties": false } }, "diagnostics": { "type": "array", "description": "Array of diagnostic information", "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Diagnostic Schema", "description": "Diagnostic information", "type": "object", "properties": { "source": { "type": "string", "description": "Source reporting the diagnostic information" }, "code": { "type": "string", "description": "Diagnostic Code" }, "message": { "type": "string", "description": "Diagnostic Message" }, "module": { "type": "string", "description": "Module reporting diagnostic information" }, "recordCount": { "type": "integer", "description": "Record Count for diagnostics" }, "query": { "type": "string", "description": "CQL Query associated with results" } } } } }, "additionalProperties": false } }, "required": [ "users", "totalRecords" ] }
- migrateusers()
Migrate users from mod-users to Keycloak
POST /users-keycloak/migrations- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestUnprocessableEntity – Validation errors
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "userMigrationJob.json", "title": "User Migration Job Schema", "description": "A user migration job entity for tracking migration's progress", "type": "object", "properties": { "id": { "description": "An migration job identifier", "type": "string", "format": "uuid" }, "status": { "$schema": "http://json-schema.org/draft-04/schema#", "id": "types/userMigrationJobStatus.json", "title": "User Migration Job Status Schema", "description": "An user migration job status", "type": "string", "enum": [ "in_progress", "failed", "finished" ] }, "totalRecords": { "type": "integer" }, "startedAt": { "description": "A user migration job start timestamp", "type": "string", "format": "date-time" }, "finishedAt": { "description": "A user migration job end timestamp", "type": "string", "format": "date-time" } } }
- passwordreset(passwordReset)
POST /users-keycloak/password-reset/reset- Parameters
passwordReset (dict) – See Schema below.
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestUnprocessableEntity – Validation errors
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Password reset entity", "type": "object", "properties": { "newPassword": { "description": "New password", "type": "string" } }, "additionalProperties": false, "required": [ "newPassword" ] }
{ "type": "string" }
- recoverforgottenusername(identifier)
called when a user has forgotten a username
POST /users-keycloak/forgotten/username- Parameters
identifier (dict) – See Schema below.
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestUnprocessableEntity – Validation errors
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Identifier", "properties": { "id": { "type": "string", "description": "Id" } } }
{ "type": "string" }
- resetforgottenpassword(identifier)
called when a user has forgotten a password
POST /users-keycloak/forgotten/password- Parameters
identifier (dict) – See Schema below.
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestUnprocessableEntity – Validation errors
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Identifier", "properties": { "id": { "type": "string", "description": "Id" } } }
{ "type": "string" }
- updateuser(user, id_)
Update user with given id
PUT /users-keycloak/users/{id}- Parameters
user (dict) – See Schema below.
- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestError – Bad request, e.g. malformed request body or query parameter
OkapiRequestNotFound – Error response if entity is not found by id (in json format)
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User Schema", "description": "A user", "type": "object", "properties": { "username": { "description": "A unique name belonging to a user. Typically used for login", "type": "string" }, "id": { "description": "A globally unique (UUID) identifier for the user", "type": "string", "format": "uuid" }, "externalSystemId": { "description": "A unique ID that corresponds to an external authority", "type": "string" }, "barcode": { "description": "The unique library barcode for this user", "type": "string" }, "active": { "description": "A flag to determine if the user's account is effective and not expired. The tenant configuration can require the user to be active for login. Active is different from the loan patron block", "type": "boolean" }, "type": { "description": "The class of user like staff or patron; this is different from patronGroup", "type": "string" }, "patronGroup": { "description": "A UUID corresponding to the group the user belongs to, see /groups API, example groups are undergraduate and faculty; loan rules, patron blocks, fees/fines and expiration days can use the patron group", "type": "string", "format": "uuid" }, "departments": { "description": "A list of UUIDs corresponding to the departments the user belongs to, see /departments API", "type": "array", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "meta": { "description": "Deprecated", "type": "object" }, "proxyFor": { "description": "Deprecated", "type": "array", "items": { "type": "string" } }, "personal": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Personal Schema", "description": "Personal information about the user", "type": "object", "properties": { "lastName": { "description": "The user's surname", "type": "string" }, "firstName": { "description": "The user's given name", "type": "string" }, "middleName": { "description": "The user's middle name (if any)", "type": "string" }, "preferredFirstName": { "description": "The user's preferred name", "type": "string" }, "email": { "description": "The user's email address", "type": "string" }, "phone": { "description": "The user's primary phone number", "type": "string" }, "mobilePhone": { "description": "The user's mobile phone number", "type": "string" }, "dateOfBirth": { "type": "string", "description": "The user's birth date", "format": "date-time" }, "addresses": { "description": "Physical addresses associated with the user", "type": "array", "minItems": 0, "items": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Address Schema", "description": "Address information", "type": "object", "properties": { "id": { "description": "A unique id for this address", "type": "string" }, "countryId": { "description": "The country code for this address", "type": "string" }, "addressLine1": { "description": "Address, Line 1", "type": "string" }, "addressLine2": { "description": "Address, Line 2", "type": "string" }, "city": { "description": "City name", "type": "string" }, "region": { "description": "Region", "type": "string" }, "postalCode": { "description": "Postal Code", "type": "string" }, "addressTypeId": { "description": "A UUID that corresponds with an address type object", "type": "string", "format": "uuid" }, "primaryAddress": { "description": "Is this the user's primary address?", "type": "boolean" } }, "required": [ "addressTypeId" ], "additionalProperties": false } }, "preferredContactTypeId": { "description": "Id of user's preferred contact type like Email, Mail or Text Message, see /addresstypes API", "type": "string" } }, "additionalProperties": false, "required": [ "lastName" ] }, "enrollmentDate": { "description": "The date in which the user joined the organization", "type": "string", "format": "date-time" }, "expirationDate": { "description": "The date for when the user becomes inactive", "type": "string", "format": "date-time" }, "createdDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "updatedDate": { "description": "Deprecated", "type": "string", "format": "date-time" }, "metadata": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Metadata Schema", "description": "Metadata about creation and changes to records, provided by the server (client should not provide)", "type": "object", "properties": { "createdDate": { "description": "Date and time when the record was created", "type": "string", "format": "date-time" }, "createdByUserId": { "description": "ID of the user who created the record (when available)", "type": "string", "format": "uuid" }, "createdByUsername": { "description": "Username of the user who created the record (when available)", "type": "string" }, "updatedDate": { "description": "Date and time when the record was last updated", "type": "string", "format": "date-time" }, "updatedByUserId": { "description": "ID of the user who last updated the record (when available)", "type": "string", "format": "uuid" }, "updatedByUsername": { "description": "Username of the user who last updated the record (when available)", "type": "string" } }, "additionalProperties": false, "required": [ "createdDate" ] }, "tags": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "tags", "description": "List of simple tags that can be added to an object", "type": "object", "properties": { "tagList": { "description": "List of tags", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }, "customFields": { "description": "Object that contains custom field", "type": "object", "additionalProperties": true } }, "additionalProperties": false }
{ "type": "string" }
- validatepasswordresetlink()
Validates password reset link
POST /users-keycloak/password-reset/validate- Returns
See Schema below.
- Return type
dict
- Raises
OkapiRequestUnprocessableEntity – Validation errors
OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.
Schema
{ "type": "string" }