https://github.com/folio-org/mod-audit
This documents the API calls that can be made to query and manage audit records
Get existing audit records or Create a new audit record
Create a new audit-datum item.
POST /audit-data
Requested language. Optional. [lang=en]
Media type: application/json
Type: json
Content:
{
"$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",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"updatedByUsername": {
"description": "Username of the user who last updated the record (when available)",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
}
},
"required": [
"tenant"
]
}
Example:
{
"strict": false,
"value": "{\n \"id\": \"1\",\n \"timestamp\": \"2018-09-27T01:50:59.466Z\",\n \"tenant\": \"diku\",\n \"login\": \"diku_admin\"\n}\n"
}
Returns a newly created item, with server-controlled fields like 'id' populated
URI to the created audit-datum item
Media type: application/json
Type: any
Example:
{
"id": "1",
"timestamp": "2018-09-27T01:50:59.466Z",
"tenant": "diku",
"login": "diku_admin"
}
Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.
Media type: text/plain
Type: any
Example:
"unable to add audit-datum -- malformed JSON at 13:3"
Not authorized to perform requested action
Media type: text/plain
Type: any
Example:
unable to create audit-data -- unauthorized
Validation errors
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A set of errors",
"type": "object",
"properties": {
"errors": {
"description": "List of errors",
"id": "errors",
"type": "array",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "An error",
"properties": {
"message": {
"type": "string",
"description": "Error message text"
},
"type": {
"type": "string",
"description": "Error message type"
},
"code": {
"type": "string",
"description": "Error message code"
},
"parameters": {
"type": "object",
"description": "Error message parameters",
"$schema": "http://json-schema.org/draft-04/schema#",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
},
"required": [
"message"
]
}
},
"total_records": {
"description": "Total number of errors",
"type": "integer"
}
}
}
Example:
{
"errors": [
{
"message": "may not be null",
"type": "1",
"code": "-1",
"parameters": [
{
"key": "moduleTo",
"value": "null"
}
]
}
]
}
Internal server error, e.g. due to misconfiguration
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator
Retrieve a list of audit-datum items.
GET /audit-data
A query expressed as a CQL string (see 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
Skip over a number of elements by specifying an offset value for the query
Example:
0
Limit the number of elements returned in the response
Example:
10
Requested language. Optional. [lang=en]
Returns a list of audit-datum items
Media type: application/json
Type: json
Content:
{
"$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",
"$schema": "http://json-schema.org/draft-04/schema#",
"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",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"updatedByUsername": {
"description": "Username of the user who last updated the record (when available)",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
}
},
"required": [
"tenant"
]
}
},
"totalRecords": {
"type": "integer"
}
},
"required": [
"audit",
"totalRecords"
]
}
Example:
{
"strict": false,
"value": "{\n \"audit\": [\n {\n \"id\": \"1\",\n \"timestamp\": \"2018-09-27T01:50:59.466Z\",\n \"tenant\": \"diku\",\n \"login\": \"diku_admin\"\n },\n {\n \"id\": \"2\",\n \"timestamp\": \"2018-09-27T01:50:59.467Z\",\n \"tenant\": \"diku\",\n \"login\": \"diku_admin\"\n }\n ],\n \"totalRecords\": 2\n}\n"
}
Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.
Media type: text/plain
Type: any
Example:
unable to list audit-data -- malformed parameter 'query', syntax error at column 6
Not authorized to perform requested action
Media type: text/plain
Type: any
Example:
unable to list audit-data -- unauthorized
Validation errors
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A set of errors",
"type": "object",
"properties": {
"errors": {
"description": "List of errors",
"id": "errors",
"type": "array",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "An error",
"properties": {
"message": {
"type": "string",
"description": "Error message text"
},
"type": {
"type": "string",
"description": "Error message type"
},
"code": {
"type": "string",
"description": "Error message code"
},
"parameters": {
"type": "object",
"description": "Error message parameters",
"$schema": "http://json-schema.org/draft-04/schema#",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
},
"required": [
"message"
]
}
},
"total_records": {
"description": "Total number of errors",
"type": "integer"
}
}
}
Example:
{
"errors": [
{
"message": "may not be null",
"type": "1",
"code": "-1",
"parameters": [
{
"key": "moduleTo",
"value": "null"
}
]
}
]
}
Internal server error, e.g. due to misconfiguration
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
Retrieve audit-datum item with given {audit-datumId}
GET /audit-data/{id}
Requested language. Optional. [lang=en]
Returns item with a given ID
Media type: application/json
Type: json
Content:
{
"$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",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"updatedByUsername": {
"description": "Username of the user who last updated the record (when available)",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
}
},
"required": [
"tenant"
]
}
Example:
{
"strict": false,
"value": "{\n \"id\": \"1\",\n \"timestamp\": \"2018-09-27T01:50:59.466Z\",\n \"tenant\": \"diku\",\n \"login\": \"diku_admin\"\n}\n"
}
Bad request
Media type: text/plain
Type: any
Not authorized to perform requested action
Media type: text/plain
Type: any
Item with a given ID not found
Media type: text/plain
Type: any
Example:
"audit-datum not found"
Internal server error, e.g. due to misconfiguration
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
Update audit-datum item with given {audit-datumId}
PUT /audit-data/{id}
Requested language. Optional. [lang=en]
Media type: application/json
Type: json
Content:
{
"$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",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"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",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"updatedByUsername": {
"description": "Username of the user who last updated the record (when available)",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
}
},
"required": [
"tenant"
]
}
Example:
{
"strict": false,
"value": "{\n \"id\": \"1\",\n \"timestamp\": \"2018-09-27T01:50:59.466Z\",\n \"tenant\": \"diku\",\n \"login\": \"diku_admin\"\n}\n"
}
Item successfully updated
Bad request
Media type: text/plain
Type: any
Example:
"unable to update audit-datum -- malformed JSON at 13:4"
Not authorized to perform requested action
Media type: text/plain
Type: any
Item with a given ID not found
Media type: text/plain
Type: any
Example:
"audit-datum not found"
Validation errors
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A set of errors",
"type": "object",
"properties": {
"errors": {
"description": "List of errors",
"id": "errors",
"type": "array",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "An error",
"properties": {
"message": {
"type": "string",
"description": "Error message text"
},
"type": {
"type": "string",
"description": "Error message type"
},
"code": {
"type": "string",
"description": "Error message code"
},
"parameters": {
"type": "object",
"description": "Error message parameters",
"$schema": "http://json-schema.org/draft-04/schema#",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
},
"required": [
"message"
]
}
},
"total_records": {
"description": "Total number of errors",
"type": "integer"
}
}
}
Example:
{
"errors": [
{
"message": "may not be null",
"type": "1",
"code": "-1",
"parameters": [
{
"key": "moduleTo",
"value": "null"
}
]
}
]
}
Internal server error, e.g. due to misconfiguration
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
Delete audit-datum item with given {audit-datumId}
DELETE /audit-data/{id}
Requested language. Optional. [lang=en]
Item deleted successfully
Bad request
Media type: text/plain
Type: any
Example:
"unable to delete audit-datum -- constraint violation"
Not authorized to perform requested action
Media type: text/plain
Type: any
Item with a given ID not found
Media type: text/plain
Type: any
Example:
"audit-datum not found"
Internal server error, e.g. due to misconfiguration
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator