foliolib.folio.api.audit.AuditData

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

Bases: foliolib.folio.FolioApi

mod-audit API

This documents the API calls that can be made to query and manage audit records

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_auditDatum(auditDataId)

Delete auditDatum item with given {auditDatumId}

get_auditData(**kwargs)

Retrieve a list of auditDatum items.

get_auditDatum(auditDataId)

Retrieve auditDatum item with given {auditDatumId}

modify_auditDatum(auditDataId, auditDatum)

Update auditDatum item with given {auditDatumId}

set_auditDatum(auditDatum)

Create a new auditDatum item.

delete_auditDatum(auditDataId: str)

Delete auditDatum item with given {auditDatumId}

DELETE /audit-data/{auditDataId}

Parameters

auditDataId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

  • OkapiRequestUnauthorized – Authentication is required

get_auditData(**kwargs)

Retrieve a list of auditDatum items.

GET /audit-data

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 link = 1234

    Example

    • (username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode

    • link=/users/1234

  • 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

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Collection of audit records",
  "properties": {
    "audit": {
      "type": "array",
      "description": "audit records",
      "items": {
        "type": "object",
        "$ref": "audit.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "audit",
    "totalRecords"
  ]
}
get_auditDatum(auditDataId: str)

Retrieve auditDatum item with given {auditDatumId}

GET /audit-data/{auditDataId}

Parameters

auditDataId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Info that an audit record contains",
  "additionalProperties": true,
  "properties": {
    "id": {
      "type": "string",
      "description": "id"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "timestamp"
    },
    "tenant": {
      "type": "string",
      "description": "tenant"
    },
    "user": {
      "type": "string",
      "description": "user"
    },
    "login": {
      "type": "string",
      "description": "login"
    },
    "uri": {
      "type": "string",
      "description": "uri"
    },
    "path": {
      "type": "string",
      "description": "path"
    },
    "params": {
      "type": "object",
      "description": "params"
    },
    "path_params": {
      "type": "object",
      "description": "path_params"
    },
    "request_id": {
      "type": "string",
      "description": "request_id"
    },
    "auth_result": {
      "type": "string",
      "description": "auth_result"
    },
    "auth_error": {
      "type": "object",
      "description": "auth_error"
    },
    "module_result": {
      "type": "string",
      "description": "module_result"
    },
    "module_error": {
      "type": "object",
      "description": "module_error"
    },
    "target_type": {
      "type": "string",
      "description": "target_type"
    },
    "target_id": {
      "type": "string",
      "description": "target_id"
    },
    "method": {
      "type": "string",
      "description": "method"
    },
    "extra_targets": {
      "type": "object",
      "description": "extra_targets"
    },
    "ip": {
      "type": "string",
      "description": "client IP"
    },
    "extra_headers": {
      "type": "object",
      "description": "extra_headers"
    },
    "metadata": {
      "type": "object",
      "description": "metadata",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "tenant"
  ]
}
modify_auditDatum(auditDataId: str, auditDatum: dict)

Update auditDatum item with given {auditDatumId}

PUT /audit-data/{auditDataId}

Parameters
  • auditDataId (str) –

  • auditDatum (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Info that an audit record contains",
  "additionalProperties": true,
  "properties": {
    "id": {
      "type": "string",
      "description": "id"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "timestamp"
    },
    "tenant": {
      "type": "string",
      "description": "tenant"
    },
    "user": {
      "type": "string",
      "description": "user"
    },
    "login": {
      "type": "string",
      "description": "login"
    },
    "uri": {
      "type": "string",
      "description": "uri"
    },
    "path": {
      "type": "string",
      "description": "path"
    },
    "params": {
      "type": "object",
      "description": "params"
    },
    "path_params": {
      "type": "object",
      "description": "path_params"
    },
    "request_id": {
      "type": "string",
      "description": "request_id"
    },
    "auth_result": {
      "type": "string",
      "description": "auth_result"
    },
    "auth_error": {
      "type": "object",
      "description": "auth_error"
    },
    "module_result": {
      "type": "string",
      "description": "module_result"
    },
    "module_error": {
      "type": "object",
      "description": "module_error"
    },
    "target_type": {
      "type": "string",
      "description": "target_type"
    },
    "target_id": {
      "type": "string",
      "description": "target_id"
    },
    "method": {
      "type": "string",
      "description": "method"
    },
    "extra_targets": {
      "type": "object",
      "description": "extra_targets"
    },
    "ip": {
      "type": "string",
      "description": "client IP"
    },
    "extra_headers": {
      "type": "object",
      "description": "extra_headers"
    },
    "metadata": {
      "type": "object",
      "description": "metadata",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "tenant"
  ]
}
set_auditDatum(auditDatum: dict)

Create a new auditDatum item.

POST /audit-data

Parameters

auditDatum (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created auditDatum item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Info that an audit record contains",
  "additionalProperties": true,
  "properties": {
    "id": {
      "type": "string",
      "description": "id"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "timestamp"
    },
    "tenant": {
      "type": "string",
      "description": "tenant"
    },
    "user": {
      "type": "string",
      "description": "user"
    },
    "login": {
      "type": "string",
      "description": "login"
    },
    "uri": {
      "type": "string",
      "description": "uri"
    },
    "path": {
      "type": "string",
      "description": "path"
    },
    "params": {
      "type": "object",
      "description": "params"
    },
    "path_params": {
      "type": "object",
      "description": "path_params"
    },
    "request_id": {
      "type": "string",
      "description": "request_id"
    },
    "auth_result": {
      "type": "string",
      "description": "auth_result"
    },
    "auth_error": {
      "type": "object",
      "description": "auth_error"
    },
    "module_result": {
      "type": "string",
      "description": "module_result"
    },
    "module_error": {
      "type": "object",
      "description": "module_error"
    },
    "target_type": {
      "type": "string",
      "description": "target_type"
    },
    "target_id": {
      "type": "string",
      "description": "target_id"
    },
    "method": {
      "type": "string",
      "description": "method"
    },
    "extra_targets": {
      "type": "object",
      "description": "extra_targets"
    },
    "ip": {
      "type": "string",
      "description": "client IP"
    },
    "extra_headers": {
      "type": "object",
      "description": "extra_headers"
    },
    "metadata": {
      "type": "object",
      "description": "metadata",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "tenant"
  ]
}