foliolib.folio.api.notes.Notes

class foliolib.folio.api.notes.Notes(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

Notes API

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

createnote(note)

Create a new note.

createnotetype(noteType)

Create a new note type.

deletenote(id_)

Delete note with given ID

deletenotetype(id_)

Delete note type with given ID

getnote(id_)

Retrieve note with given ID

getnotecollection(**kwargs)

Return a list of notes

getnotecollectionbylink(domain, objectType, ...)

Return a list of notes by status.

getnotetype(id_)

Retrieve note type with given ID

getnotetypecollection(**kwargs)

Return a list of note types

updatelinks(noteLinkUpdateCollection, ...)

Add or delete links to specified list of notes

updatenote(note, id_)

Update note with given ID

updatenotetype(noteType, id_)

Update note type with given ID

createnote(note)

Create a new note.

POST /notes

Parameters

note (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "description": "Notes about all kind of objects",
    "properties": {
        "id": {
            "$ref": "common.yaml#/uuid",
            "description": "Unique generated identifier for the note"
        },
        "typeId": {
            "$ref": "common.yaml#/uuid",
            "description": "Type id of note"
        },
        "type": {
            "type": "string",
            "description": "Type of note (configured in settings)"
        },
        "title": {
            "type": "string",
            "description": "Note title"
        },
        "domain": {
            "type": "string",
            "description": "Domain associated with this note"
        },
        "content": {
            "type": "string",
            "description": "Content of the note"
        },
        "popUpOnCheckOut": {
            "type": "boolean",
            "description": "Flag that specify need of pop-up on check-out app"
        },
        "popUpOnUser": {
            "type": "boolean",
            "description": "Flag that specify need of pop-up on users app"
        },
        "links": {
            "type": "array",
            "description": "Collection of links to associated objects",
            "items": {
                "$ref": "link.yaml#/link"
            }
        },
        "metadata": {
            "$ref": "common.yaml#/metadata"
        }
    },
    "required": [
        "typeId",
        "domain",
        "title"
    ]
}
createnotetype(noteType)

Create a new note type.

POST /note-types

Parameters

noteType (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "title": "Note Type",
    "description": "Defines type of note",
    "properties": {
        "id": {
            "$ref": "common.yaml#/uuid",
            "description": "A UUID identifying this note type"
        },
        "name": {
            "type": "string",
            "description": "The unique name of this type",
            "maxLength": 255
        },
        "usage": {
            "type": "object",
            "readOnly": true,
            "description": "Type usage statistics",
            "properties": {
                "isAssigned": {
                    "type": "boolean",
                    "readOnly": true,
                    "description": "Is this note type assigned to any note"
                }
            },
            "required": [
                "noteTotal"
            ]
        },
        "metadata": {
            "$ref": "common.yaml#/metadata",
            "readOnly": true,
            "description": "The metadata"
        }
    },
    "required": [
        "name"
    ],
    "example": {
        "id": "118dbd8c-5ba0-47a9-a850-34bbb1dbf3b7",
        "name": "Important Note"
    }
}
deletenote(id_)

Delete note with given ID

DELETE /notes/{id}

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiFatalError – Unexpected error

deletenotetype(id_)

Delete note type with given ID

DELETE /note-types/{id}

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiFatalError – Unexpected error

getnote(id_)

Retrieve note with given ID

GET /notes/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "description": "Notes about all kind of objects",
    "properties": {
        "id": {
            "$ref": "common.yaml#/uuid",
            "description": "Unique generated identifier for the note"
        },
        "typeId": {
            "$ref": "common.yaml#/uuid",
            "description": "Type id of note"
        },
        "type": {
            "type": "string",
            "description": "Type of note (configured in settings)"
        },
        "title": {
            "type": "string",
            "description": "Note title"
        },
        "domain": {
            "type": "string",
            "description": "Domain associated with this note"
        },
        "content": {
            "type": "string",
            "description": "Content of the note"
        },
        "popUpOnCheckOut": {
            "type": "boolean",
            "description": "Flag that specify need of pop-up on check-out app"
        },
        "popUpOnUser": {
            "type": "boolean",
            "description": "Flag that specify need of pop-up on users app"
        },
        "links": {
            "type": "array",
            "description": "Collection of links to associated objects",
            "items": {
                "$ref": "link.yaml#/link"
            }
        },
        "metadata": {
            "$ref": "common.yaml#/metadata"
        }
    },
    "required": [
        "typeId",
        "domain",
        "title"
    ]
}
getnotecollection(**kwargs)

Return a list of notes

GET /notes

Keyword Arguments
  • query (str) – A query expressed as a CQL string, for details see [Notes API](https://github.com/folio-org/mod-notes/blob/master/docs/api-guide.md#notes-api) (default: cql.allRecords=1)

  • offset (int) – Skip over a number of elements by specifying an offset value for the query (default: 0, minimum: 0, maximum: 2147483647)

  • limit (int) – Limit the number of elements returned in the response (default: 1000, minimum: 1, maximum: 2147483647)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "title": "Collection of notes",
    "description": "Collection of notes",
    "properties": {
        "notes": {
            "type": "array",
            "items": {
                "$ref": "#/note"
            }
        },
        "totalRecords": {
            "type": "integer",
            "readOnly": true,
            "description": "Total amount of notes"
        }
    },
    "required": [
        "notes"
    ]
}

Return a list of notes by status. A maximum of 1000 notes can be returned per request.

GET /note-links/domain/{domain}/type/{objectType}/id/{objectId}

Keyword Arguments
  • search (str) – Partial match case-insensitive search term for note title and note content

  • noteType (list) – Search string for note type. Note(s) is returned only if it equals to specified word or sequence of words in the titleseparated by com type name. Multiple types should be declared with query parameter sequentially as follows “noteType=a&noteType=b”. (items: (type: string))

  • status (str) –

  • orderBy (str) –

  • order (str) –

  • offset (int) – Skip over a number of elements by specifying an offset value for the query (default: 0, minimum: 0, maximum: 2147483647)

  • limit (int) – Limit the number of elements returned in the response (default: 1000, minimum: 1, maximum: 2147483647)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "title": "Collection of notes",
    "description": "Collection of notes",
    "properties": {
        "notes": {
            "type": "array",
            "items": {
                "$ref": "#/note"
            }
        },
        "totalRecords": {
            "type": "integer",
            "readOnly": true,
            "description": "Total amount of notes"
        }
    },
    "required": [
        "notes"
    ]
}
getnotetype(id_)

Retrieve note type with given ID

GET /note-types/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "title": "Note Type",
    "description": "Defines type of note",
    "properties": {
        "id": {
            "$ref": "common.yaml#/uuid",
            "description": "A UUID identifying this note type"
        },
        "name": {
            "type": "string",
            "description": "The unique name of this type",
            "maxLength": 255
        },
        "usage": {
            "type": "object",
            "readOnly": true,
            "description": "Type usage statistics",
            "properties": {
                "isAssigned": {
                    "type": "boolean",
                    "readOnly": true,
                    "description": "Is this note type assigned to any note"
                }
            },
            "required": [
                "noteTotal"
            ]
        },
        "metadata": {
            "$ref": "common.yaml#/metadata",
            "readOnly": true,
            "description": "The metadata"
        }
    },
    "required": [
        "name"
    ],
    "example": {
        "id": "118dbd8c-5ba0-47a9-a850-34bbb1dbf3b7",
        "name": "Important Note"
    }
}
getnotetypecollection(**kwargs)

Return a list of note types

GET /note-types

Keyword Arguments
  • query (str) – A query expressed as a CQL string, for details see [Note Types API](https://github.com/folio-org/mod-notes/blob/master/docs/api-guide.md#note-types-api) (default: cql.allRecords=1)

  • offset (int) – Skip over a number of elements by specifying an offset value for the query (default: 0, minimum: 0, maximum: 2147483647)

  • limit (int) – Limit the number of elements returned in the response (default: 1000, minimum: 1, maximum: 2147483647)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "title": "Collection of note types",
    "description": "Collection of note types",
    "properties": {
        "noteTypes": {
            "type": "array",
            "items": {
                "$ref": "#/noteType"
            }
        },
        "totalRecords": {
            "type": "integer",
            "readOnly": true,
            "description": "Total amount of note types"
        }
    },
    "required": [
        "noteTypes"
    ],
    "example": {
        "noteTypes": [
            {
                "id": "118dbd8c-5ba0-47a9-a850-34bbb1dbf3b7",
                "name": "Important Note"
            },
            {
                "id": "46669e09-8b45-4ede-afbd-ca73bb89cdb3",
                "label": "Urgent Note"
            }
        ],
        "totalRecords": 2
    }
}

Add or delete links to specified list of notes

PUT /note-links/type/{objectType}/id/{objectId}

Parameters

noteLinkUpdateCollection (dict) – See Schema below.

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "description": "Collection of note links",
    "properties": {
        "notes": {
            "type": "array",
            "items": {
                "$ref": "#/noteLinkUpdate"
            }
        }
    },
    "required": [
        "notes"
    ]
}
updatenote(note, id_)

Update note with given ID

PUT /notes/{id}

Parameters

note (dict) – See Schema below.

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "description": "Notes about all kind of objects",
    "properties": {
        "id": {
            "$ref": "common.yaml#/uuid",
            "description": "Unique generated identifier for the note"
        },
        "typeId": {
            "$ref": "common.yaml#/uuid",
            "description": "Type id of note"
        },
        "type": {
            "type": "string",
            "description": "Type of note (configured in settings)"
        },
        "title": {
            "type": "string",
            "description": "Note title"
        },
        "domain": {
            "type": "string",
            "description": "Domain associated with this note"
        },
        "content": {
            "type": "string",
            "description": "Content of the note"
        },
        "popUpOnCheckOut": {
            "type": "boolean",
            "description": "Flag that specify need of pop-up on check-out app"
        },
        "popUpOnUser": {
            "type": "boolean",
            "description": "Flag that specify need of pop-up on users app"
        },
        "links": {
            "type": "array",
            "description": "Collection of links to associated objects",
            "items": {
                "$ref": "link.yaml#/link"
            }
        },
        "metadata": {
            "$ref": "common.yaml#/metadata"
        }
    },
    "required": [
        "typeId",
        "domain",
        "title"
    ]
}
updatenotetype(noteType, id_)

Update note type with given ID

PUT /note-types/{id}

Parameters

noteType (dict) – See Schema below.

Raises
  • OkapiRequestUnauthorized – Not authorized to perform requested action

  • OkapiRequestNotFound – Resource with a given ID not found

  • OkapiFatalError – Unexpected error

Schema

{
    "type": "object",
    "title": "Note Type",
    "description": "Defines type of note",
    "properties": {
        "id": {
            "$ref": "common.yaml#/uuid",
            "description": "A UUID identifying this note type"
        },
        "name": {
            "type": "string",
            "description": "The unique name of this type",
            "maxLength": 255
        },
        "usage": {
            "type": "object",
            "readOnly": true,
            "description": "Type usage statistics",
            "properties": {
                "isAssigned": {
                    "type": "boolean",
                    "readOnly": true,
                    "description": "Is this note type assigned to any note"
                }
            },
            "required": [
                "noteTotal"
            ]
        },
        "metadata": {
            "$ref": "common.yaml#/metadata",
            "readOnly": true,
            "description": "The metadata"
        }
    },
    "required": [
        "name"
    ],
    "example": {
        "id": "118dbd8c-5ba0-47a9-a850-34bbb1dbf3b7",
        "name": "Important Note"
    }
}