foliolib.folio.api.organizationsStorage.Contact
- class foliolib.folio.api.organizationsStorage.Contact(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiContacts
CRUD APIs used to manage contacts.
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_contact(contactsId)Delete contact item with given {contactId}
get_contact(contactsId)Retrieve contact item with given {contactId}
get_contacts(**kwargs)Get list of contact persons
modify_contact(contactsId, contact)Update contact item with given {contactId}
set_contact(contact)Create a new contact item.
- delete_contact(contactsId: str)
Delete contact item with given {contactId}
DELETE /organizations-storage/contacts/{contactsId}- Parameters
contactsId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_contact(contactsId: str)
Retrieve contact item with given {contactId}
GET /organizations-storage/contacts/{contactsId}- Parameters
contactsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A contact record", "type": "object", "properties": { "id": { "description": "The unique id of this contact", "$ref": "../../common/schemas/uuid.json" }, "prefix": { "description": "The prefix for this contact person", "type": "string" }, "firstName": { "description": "The first name of this contact person", "type": "string" }, "lastName": { "description": "The last name of this contact person", "type": "string" }, "language": { "description": "The preferred language for this contact person", "type": "string" }, "notes": { "description": "The notes for this contact person", "type": "string" }, "phoneNumbers": { "id": "phoneNumbers", "description": "The list of phone numbers for this contact person", "type": "array", "items": { "type": "object", "$ref": "phone_number.json" } }, "emails": { "id": "emailAddresses", "description": "The list of emails for this contact person", "type": "array", "items": { "type": "object", "$ref": "email.json" } }, "addresses": { "id": "addresses", "description": "The list of addresses for this contact person", "type": "array", "items": { "type": "object", "$ref": "address.json" } }, "urls": { "id": "urls", "description": "The list of URLs for this contact person", "type": "array", "items": { "type": "object", "$ref": "url.json" } }, "categories": { "id": "contactCategory", "description": "The list of contact categories associated with this organization contact person", "type": "array", "items": { "description": "UUID of the contact category", "$ref": "../../common/schemas/uuid.json" } }, "inactive": { "description": "Used to indicate that a contact is no longer active", "type": "boolean", "default": false }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "firstName", "lastName" ] }
- get_contacts(**kwargs)
Get list of contact persons
GET /organizations-storage/contacts- 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.
with valid searchable fields: for example code
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
[“code”, “MEDGRANT”, “=”]
totalRecords (str) –
(default=auto) How to calculate the totalRecords property. “exact” for the correct number, “estimated” for an estimation, “auto” to automatically select “exact” or “estimated”, “none” for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords
Example
none
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#", "description": "collection of contact records", "type": "object", "properties": { "contacts": { "description": "The list of contacts in this collection", "type": "array", "id": "contacts", "items": { "type": "object", "$ref": "contact.json" } }, "totalRecords": { "description": "The number of contact person records returned in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "contacts", "totalRecords" ] }
- modify_contact(contactsId: str, contact: dict)
Update contact item with given {contactId}
PUT /organizations-storage/contacts/{contactsId}- Parameters
contactsId (str) –
contact (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestConflict – Conflict
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A contact record", "type": "object", "properties": { "id": { "description": "The unique id of this contact", "$ref": "../../common/schemas/uuid.json" }, "prefix": { "description": "The prefix for this contact person", "type": "string" }, "firstName": { "description": "The first name of this contact person", "type": "string" }, "lastName": { "description": "The last name of this contact person", "type": "string" }, "language": { "description": "The preferred language for this contact person", "type": "string" }, "notes": { "description": "The notes for this contact person", "type": "string" }, "phoneNumbers": { "id": "phoneNumbers", "description": "The list of phone numbers for this contact person", "type": "array", "items": { "type": "object", "$ref": "phone_number.json" } }, "emails": { "id": "emailAddresses", "description": "The list of emails for this contact person", "type": "array", "items": { "type": "object", "$ref": "email.json" } }, "addresses": { "id": "addresses", "description": "The list of addresses for this contact person", "type": "array", "items": { "type": "object", "$ref": "address.json" } }, "urls": { "id": "urls", "description": "The list of URLs for this contact person", "type": "array", "items": { "type": "object", "$ref": "url.json" } }, "categories": { "id": "contactCategory", "description": "The list of contact categories associated with this organization contact person", "type": "array", "items": { "description": "UUID of the contact category", "$ref": "../../common/schemas/uuid.json" } }, "inactive": { "description": "Used to indicate that a contact is no longer active", "type": "boolean", "default": false }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "firstName", "lastName" ] }
- set_contact(contact: dict)
Create a new contact item.
POST /organizations-storage/contacts- Parameters
contact (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Headers
Location - URI to the created contact item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A contact record", "type": "object", "properties": { "id": { "description": "The unique id of this contact", "$ref": "../../common/schemas/uuid.json" }, "prefix": { "description": "The prefix for this contact person", "type": "string" }, "firstName": { "description": "The first name of this contact person", "type": "string" }, "lastName": { "description": "The last name of this contact person", "type": "string" }, "language": { "description": "The preferred language for this contact person", "type": "string" }, "notes": { "description": "The notes for this contact person", "type": "string" }, "phoneNumbers": { "id": "phoneNumbers", "description": "The list of phone numbers for this contact person", "type": "array", "items": { "type": "object", "$ref": "phone_number.json" } }, "emails": { "id": "emailAddresses", "description": "The list of emails for this contact person", "type": "array", "items": { "type": "object", "$ref": "email.json" } }, "addresses": { "id": "addresses", "description": "The list of addresses for this contact person", "type": "array", "items": { "type": "object", "$ref": "address.json" } }, "urls": { "id": "urls", "description": "The list of URLs for this contact person", "type": "array", "items": { "type": "object", "$ref": "url.json" } }, "categories": { "id": "contactCategory", "description": "The list of contact categories associated with this organization contact person", "type": "array", "items": { "description": "UUID of the contact category", "$ref": "../../common/schemas/uuid.json" } }, "inactive": { "description": "Used to indicate that a contact is no longer active", "type": "boolean", "default": false }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "firstName", "lastName" ] }