folio-custom-fields version v0.1
https://github.com/folio-org/folio-custom-fields
folio-custom-fields, a library and common interface for custom fields to be used by several modules
FOLIO module library to store and maintain custom fields using Okapi's multiple interfaces feature. All modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints. The client must set the X-Okapi-Module-Id header, for details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Custom Fields
Collection of custom-field items.
Create a new custom-field item.
Update all custom fields and delete fields that are not mentioned in request
Retrieve a list of custom-field items.
post /custom-fields
Create a new custom-field item.
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Custom field collection item",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique generated identifier for the custom field",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da",
"$schema": "http://json-schema.org/draft-04/schema#",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"name": {
"type": "string",
"description": "The name of the custom field",
"example": "Department"
},
"refId": {
"type": "string",
"description": "The reference id of the custom field. Read only, autogenerated field",
"example": "department_1",
"readonly": true
},
"type": {
"type": "string",
"description": "The type of the custom field",
"example": "RADIO_BUTTON",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Custom Field Types Schema",
"additionalProperties": false,
"enum": [
"RADIO_BUTTON",
"SINGLE_CHECKBOX",
"SINGLE_SELECT_DROPDOWN",
"MULTI_SELECT_DROPDOWN",
"TEXTBOX_SHORT",
"TEXTBOX_LONG",
"DATE_PICKER"
]
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field is assigned to",
"example": "package"
},
"visible": {
"type": "boolean",
"description": "Defines visibility of the custom field",
"default": true,
"example": true
},
"required": {
"type": "boolean",
"description": "Defines if the custom field is required",
"default": false,
"example": true
},
"isRepeatable": {
"type": "boolean",
"description": "Defines if the custom field is repeatable",
"default": false,
"example": true
},
"order": {
"type": "integer",
"description": "The order of the custom field to be displayed",
"example": 1,
"readonly": true
},
"helpText": {
"type": "string",
"description": "The description of the custom field",
"example": "Provide a department"
},
"checkboxField": {
"type": "object",
"description": "Checkbox field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Checkbox Field Schema",
"additionalProperties": false,
"properties": {
"default": {
"type": "boolean",
"description": "Defines if the custom field is default",
"example": false,
"default": false
}
}
},
"selectField": {
"type": "object",
"description": "Select field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Select Field Schema",
"additionalProperties": false,
"properties": {
"multiSelect": {
"type": "boolean",
"description": "Defines if the custom field is a multi select",
"example": false
},
"options": {
"type": "object",
"description": "Defines the options for the custom field",
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOptions",
"properties": {
"values": {
"type": "array",
"description": "Defines the possible values for the custom field",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Select Field Option Schema",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOption",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the option",
"pattern": "opt_\\d{1,5}",
"example": "opt_1"
},
"value": {
"type": "string",
"description": "Possible value of the custom field",
"example": "Engineering"
},
"default": {
"type": "boolean",
"description": "Indicates that this value is default",
"default": false,
"example": false
}
},
"required": [
"value"
]
}
},
"sortingOrder": {
"type": "string",
"enum": [
"ASC",
"DESC",
"CUSTOM"
],
"description": "Defines sorting order for the custom field",
"example": "ASC",
"default": "CUSTOM"
}
},
"required": [
"values"
]
}
},
"required": [
"multiSelect",
"options"
]
},
"textField": {
"type": "object",
"description": "Text field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Textbox Field Schema",
"additionalProperties": false,
"properties": {
"fieldFormat": {
"type": "string",
"description": "Defines custom field format option",
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"TEXT",
"EMAIL",
"URL",
"NUMBER"
],
"example": "EMAIL",
"default": "TEXT"
}
},
"required": [
"fieldFormat"
]
},
"displayInAccordion": {
"type": "string",
"description": "Display in accordion names for the custom field"
},
"metadata": {
"description": "User metadata information",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"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": [
"name",
"type",
"entityType"
]
}
Example:
{
"name": "Department",
"refId": "department",
"visible": true,
"required": true,
"helpText": "Provide a department",
"entityType": "package",
"type": "SINGLE_SELECT_DROPDOWN"
}
HTTP status code 201
Returns a newly created item, with server-controlled fields like 'id' populated
Headers
- Location: required(string)
URI to the created custom-field item
Body
Media type: application/json
Type: any
Example:
{
"name": "Department",
"refId": "department",
"visible": true,
"required": true,
"helpText": "Provide a department",
"entityType": "package",
"type": "SINGLE_SELECT_DROPDOWN"
}
HTTP status code 400
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.
Body
Media type: text/plain
Type: any
Example:
"unable to add custom-field -- malformed JSON at 13:3"
HTTP status code 401
Not authorized to perform requested action
Body
Media type: text/plain
Type: any
Example:
unable to create custom-fields -- unauthorized
HTTP status code 422
Validation errors
Body
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"
}
]
}
]
}
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator
put /custom-fields
Update all custom fields and delete fields that are not mentioned in request
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Collection of custom fields for PUT request",
"additionalProperties": false,
"properties": {
"customFields": {
"type": "array",
"description": "An array of custom fields",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Custom field collection item",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique generated identifier for the custom field",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da",
"$schema": "http://json-schema.org/draft-04/schema#",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"name": {
"type": "string",
"description": "The name of the custom field",
"example": "Department"
},
"refId": {
"type": "string",
"description": "The reference id of the custom field. Read only, autogenerated field",
"example": "department_1",
"readonly": true
},
"type": {
"type": "string",
"description": "The type of the custom field",
"example": "RADIO_BUTTON",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Custom Field Types Schema",
"additionalProperties": false,
"enum": [
"RADIO_BUTTON",
"SINGLE_CHECKBOX",
"SINGLE_SELECT_DROPDOWN",
"MULTI_SELECT_DROPDOWN",
"TEXTBOX_SHORT",
"TEXTBOX_LONG",
"DATE_PICKER"
]
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field is assigned to",
"example": "package"
},
"visible": {
"type": "boolean",
"description": "Defines visibility of the custom field",
"default": true,
"example": true
},
"required": {
"type": "boolean",
"description": "Defines if the custom field is required",
"default": false,
"example": true
},
"isRepeatable": {
"type": "boolean",
"description": "Defines if the custom field is repeatable",
"default": false,
"example": true
},
"order": {
"type": "integer",
"description": "The order of the custom field to be displayed",
"example": 1,
"readonly": true
},
"helpText": {
"type": "string",
"description": "The description of the custom field",
"example": "Provide a department"
},
"checkboxField": {
"type": "object",
"description": "Checkbox field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Checkbox Field Schema",
"additionalProperties": false,
"properties": {
"default": {
"type": "boolean",
"description": "Defines if the custom field is default",
"example": false,
"default": false
}
}
},
"selectField": {
"type": "object",
"description": "Select field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Select Field Schema",
"additionalProperties": false,
"properties": {
"multiSelect": {
"type": "boolean",
"description": "Defines if the custom field is a multi select",
"example": false
},
"options": {
"type": "object",
"description": "Defines the options for the custom field",
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOptions",
"properties": {
"values": {
"type": "array",
"description": "Defines the possible values for the custom field",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Select Field Option Schema",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOption",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the option",
"pattern": "opt_\\d{1,5}",
"example": "opt_1"
},
"value": {
"type": "string",
"description": "Possible value of the custom field",
"example": "Engineering"
},
"default": {
"type": "boolean",
"description": "Indicates that this value is default",
"default": false,
"example": false
}
},
"required": [
"value"
]
}
},
"sortingOrder": {
"type": "string",
"enum": [
"ASC",
"DESC",
"CUSTOM"
],
"description": "Defines sorting order for the custom field",
"example": "ASC",
"default": "CUSTOM"
}
},
"required": [
"values"
]
}
},
"required": [
"multiSelect",
"options"
]
},
"textField": {
"type": "object",
"description": "Text field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Textbox Field Schema",
"additionalProperties": false,
"properties": {
"fieldFormat": {
"type": "string",
"description": "Defines custom field format option",
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"TEXT",
"EMAIL",
"URL",
"NUMBER"
],
"example": "EMAIL",
"default": "TEXT"
}
},
"required": [
"fieldFormat"
]
},
"displayInAccordion": {
"type": "string",
"description": "Display in accordion names for the custom field"
},
"metadata": {
"description": "User metadata information",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"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": [
"name",
"type",
"entityType"
]
}
},
"entityType": {
"type": "string",
"description": "The entityType of custom fields"
},
"metadata": {
"description": "User metadata information",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"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": [
"customFields",
"entityType"
]
}
Example:
{
"customFields": [
{
"name": "Department",
"refId": "department",
"visible": true,
"required": true,
"helpText": "Provide a department",
"entityType": "package",
"type": "SINGLE_SELECT_DROPDOWN"
},
{
"name": "Phone",
"refId": "phone",
"visible": true,
"required": false,
"helpText": "Phone number",
"entityType": "user",
"type": "TEXTBOX_SHORT"
}
]
}
HTTP status code 204
All custom fields successfully updated
HTTP status code 400
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.
Body
Media type: text/plain
Type: any
Example:
"unable to update /custom-fields -- malformed JSON at 13:4"
HTTP status code 500
Internal server error
Body
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
get /custom-fields
Retrieve a list of custom-field items.
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- query: (string)
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.
Query should contain custom field attributes
Example:
(username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode name=department
- offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)
Skip over a number of elements by specifying an offset value for the query
Example:
0
- limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)
Limit the number of elements returned in the response
Example:
10
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
HTTP status code 200
Returns a list of custom-field items
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Collection of custom fields",
"additionalProperties": false,
"properties": {
"customFields": {
"type": "array",
"description": "An array of custom fields",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Custom field collection item",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique generated identifier for the custom field",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da",
"$schema": "http://json-schema.org/draft-04/schema#",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"name": {
"type": "string",
"description": "The name of the custom field",
"example": "Department"
},
"refId": {
"type": "string",
"description": "The reference id of the custom field. Read only, autogenerated field",
"example": "department_1",
"readonly": true
},
"type": {
"type": "string",
"description": "The type of the custom field",
"example": "RADIO_BUTTON",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Custom Field Types Schema",
"additionalProperties": false,
"enum": [
"RADIO_BUTTON",
"SINGLE_CHECKBOX",
"SINGLE_SELECT_DROPDOWN",
"MULTI_SELECT_DROPDOWN",
"TEXTBOX_SHORT",
"TEXTBOX_LONG",
"DATE_PICKER"
]
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field is assigned to",
"example": "package"
},
"visible": {
"type": "boolean",
"description": "Defines visibility of the custom field",
"default": true,
"example": true
},
"required": {
"type": "boolean",
"description": "Defines if the custom field is required",
"default": false,
"example": true
},
"isRepeatable": {
"type": "boolean",
"description": "Defines if the custom field is repeatable",
"default": false,
"example": true
},
"order": {
"type": "integer",
"description": "The order of the custom field to be displayed",
"example": 1,
"readonly": true
},
"helpText": {
"type": "string",
"description": "The description of the custom field",
"example": "Provide a department"
},
"checkboxField": {
"type": "object",
"description": "Checkbox field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Checkbox Field Schema",
"additionalProperties": false,
"properties": {
"default": {
"type": "boolean",
"description": "Defines if the custom field is default",
"example": false,
"default": false
}
}
},
"selectField": {
"type": "object",
"description": "Select field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Select Field Schema",
"additionalProperties": false,
"properties": {
"multiSelect": {
"type": "boolean",
"description": "Defines if the custom field is a multi select",
"example": false
},
"options": {
"type": "object",
"description": "Defines the options for the custom field",
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOptions",
"properties": {
"values": {
"type": "array",
"description": "Defines the possible values for the custom field",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Select Field Option Schema",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOption",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the option",
"pattern": "opt_\\d{1,5}",
"example": "opt_1"
},
"value": {
"type": "string",
"description": "Possible value of the custom field",
"example": "Engineering"
},
"default": {
"type": "boolean",
"description": "Indicates that this value is default",
"default": false,
"example": false
}
},
"required": [
"value"
]
}
},
"sortingOrder": {
"type": "string",
"enum": [
"ASC",
"DESC",
"CUSTOM"
],
"description": "Defines sorting order for the custom field",
"example": "ASC",
"default": "CUSTOM"
}
},
"required": [
"values"
]
}
},
"required": [
"multiSelect",
"options"
]
},
"textField": {
"type": "object",
"description": "Text field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Textbox Field Schema",
"additionalProperties": false,
"properties": {
"fieldFormat": {
"type": "string",
"description": "Defines custom field format option",
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"TEXT",
"EMAIL",
"URL",
"NUMBER"
],
"example": "EMAIL",
"default": "TEXT"
}
},
"required": [
"fieldFormat"
]
},
"displayInAccordion": {
"type": "string",
"description": "Display in accordion names for the custom field"
},
"metadata": {
"description": "User metadata information",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"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": [
"name",
"type",
"entityType"
]
}
},
"totalRecords": {
"description": "Total number of records available, that match search conditions",
"type": "integer"
}
},
"required": [
"customFields",
"totalRecords"
]
}
Example:
{
"customFields": [
{
"name": "Department",
"refId": "department",
"visible": true,
"required": true,
"helpText": "Provide a department",
"entityType": "package",
"type": "SINGLE_SELECT_DROPDOWN"
},
{
"name": "Phone",
"refId": "phone",
"visible": true,
"required": false,
"helpText": "Phone number",
"entityType": "user",
"type": "TEXTBOX_SHORT"
}
]
}
HTTP status code 400
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.
Body
Media type: text/plain
Type: any
Example:
unable to list custom-fields -- malformed parameter 'query', syntax error at column 6
HTTP status code 401
Not authorized to perform requested action
Body
Media type: text/plain
Type: any
Example:
unable to list custom-fields -- unauthorized
HTTP status code 422
Validation errors
Body
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"
}
]
}
]
}
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
Get, Delete or Update a custom field
Retrieve custom-field item with given {custom-fieldId}
Delete custom-field item with given {custom-fieldId}
Update custom-field item with given {custom-fieldId}
get /custom-fields/{id}
Retrieve custom-field item with given {custom-fieldId}
URI Parameters
- id: required(string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
HTTP status code 200
Returns item with a given ID
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Custom field collection item",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique generated identifier for the custom field",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da",
"$schema": "http://json-schema.org/draft-04/schema#",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"name": {
"type": "string",
"description": "The name of the custom field",
"example": "Department"
},
"refId": {
"type": "string",
"description": "The reference id of the custom field. Read only, autogenerated field",
"example": "department_1",
"readonly": true
},
"type": {
"type": "string",
"description": "The type of the custom field",
"example": "RADIO_BUTTON",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Custom Field Types Schema",
"additionalProperties": false,
"enum": [
"RADIO_BUTTON",
"SINGLE_CHECKBOX",
"SINGLE_SELECT_DROPDOWN",
"MULTI_SELECT_DROPDOWN",
"TEXTBOX_SHORT",
"TEXTBOX_LONG",
"DATE_PICKER"
]
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field is assigned to",
"example": "package"
},
"visible": {
"type": "boolean",
"description": "Defines visibility of the custom field",
"default": true,
"example": true
},
"required": {
"type": "boolean",
"description": "Defines if the custom field is required",
"default": false,
"example": true
},
"isRepeatable": {
"type": "boolean",
"description": "Defines if the custom field is repeatable",
"default": false,
"example": true
},
"order": {
"type": "integer",
"description": "The order of the custom field to be displayed",
"example": 1,
"readonly": true
},
"helpText": {
"type": "string",
"description": "The description of the custom field",
"example": "Provide a department"
},
"checkboxField": {
"type": "object",
"description": "Checkbox field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Checkbox Field Schema",
"additionalProperties": false,
"properties": {
"default": {
"type": "boolean",
"description": "Defines if the custom field is default",
"example": false,
"default": false
}
}
},
"selectField": {
"type": "object",
"description": "Select field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Select Field Schema",
"additionalProperties": false,
"properties": {
"multiSelect": {
"type": "boolean",
"description": "Defines if the custom field is a multi select",
"example": false
},
"options": {
"type": "object",
"description": "Defines the options for the custom field",
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOptions",
"properties": {
"values": {
"type": "array",
"description": "Defines the possible values for the custom field",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Select Field Option Schema",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOption",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the option",
"pattern": "opt_\\d{1,5}",
"example": "opt_1"
},
"value": {
"type": "string",
"description": "Possible value of the custom field",
"example": "Engineering"
},
"default": {
"type": "boolean",
"description": "Indicates that this value is default",
"default": false,
"example": false
}
},
"required": [
"value"
]
}
},
"sortingOrder": {
"type": "string",
"enum": [
"ASC",
"DESC",
"CUSTOM"
],
"description": "Defines sorting order for the custom field",
"example": "ASC",
"default": "CUSTOM"
}
},
"required": [
"values"
]
}
},
"required": [
"multiSelect",
"options"
]
},
"textField": {
"type": "object",
"description": "Text field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Textbox Field Schema",
"additionalProperties": false,
"properties": {
"fieldFormat": {
"type": "string",
"description": "Defines custom field format option",
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"TEXT",
"EMAIL",
"URL",
"NUMBER"
],
"example": "EMAIL",
"default": "TEXT"
}
},
"required": [
"fieldFormat"
]
},
"displayInAccordion": {
"type": "string",
"description": "Display in accordion names for the custom field"
},
"metadata": {
"description": "User metadata information",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"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": [
"name",
"type",
"entityType"
]
}
Example:
{
"name": "Department",
"refId": "department",
"visible": true,
"required": true,
"helpText": "Provide a department",
"entityType": "package",
"type": "SINGLE_SELECT_DROPDOWN"
}
HTTP status code 404
Item with a given ID not found
Body
Media type: text/plain
Type: any
Example:
"custom-field not found"
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
delete /custom-fields/{id}
Delete custom-field item with given {custom-fieldId}
URI Parameters
- id: required(string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
HTTP status code 204
Item deleted successfully
HTTP status code 400
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.
Body
Media type: text/plain
Type: any
Example:
"unable to delete custom-field -- constraint violation"
HTTP status code 404
Item with a given ID not found
Body
Media type: text/plain
Type: any
Example:
"custom-field not found"
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator
put /custom-fields/{id}
Update custom-field item with given {custom-fieldId}
URI Parameters
- id: required(string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Custom field collection item",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique generated identifier for the custom field",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da",
"$schema": "http://json-schema.org/draft-04/schema#",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"name": {
"type": "string",
"description": "The name of the custom field",
"example": "Department"
},
"refId": {
"type": "string",
"description": "The reference id of the custom field. Read only, autogenerated field",
"example": "department_1",
"readonly": true
},
"type": {
"type": "string",
"description": "The type of the custom field",
"example": "RADIO_BUTTON",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Custom Field Types Schema",
"additionalProperties": false,
"enum": [
"RADIO_BUTTON",
"SINGLE_CHECKBOX",
"SINGLE_SELECT_DROPDOWN",
"MULTI_SELECT_DROPDOWN",
"TEXTBOX_SHORT",
"TEXTBOX_LONG",
"DATE_PICKER"
]
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field is assigned to",
"example": "package"
},
"visible": {
"type": "boolean",
"description": "Defines visibility of the custom field",
"default": true,
"example": true
},
"required": {
"type": "boolean",
"description": "Defines if the custom field is required",
"default": false,
"example": true
},
"isRepeatable": {
"type": "boolean",
"description": "Defines if the custom field is repeatable",
"default": false,
"example": true
},
"order": {
"type": "integer",
"description": "The order of the custom field to be displayed",
"example": 1,
"readonly": true
},
"helpText": {
"type": "string",
"description": "The description of the custom field",
"example": "Provide a department"
},
"checkboxField": {
"type": "object",
"description": "Checkbox field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Checkbox Field Schema",
"additionalProperties": false,
"properties": {
"default": {
"type": "boolean",
"description": "Defines if the custom field is default",
"example": false,
"default": false
}
}
},
"selectField": {
"type": "object",
"description": "Select field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Select Field Schema",
"additionalProperties": false,
"properties": {
"multiSelect": {
"type": "boolean",
"description": "Defines if the custom field is a multi select",
"example": false
},
"options": {
"type": "object",
"description": "Defines the options for the custom field",
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOptions",
"properties": {
"values": {
"type": "array",
"description": "Defines the possible values for the custom field",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Select Field Option Schema",
"additionalProperties": false,
"javaType": "org.folio.rest.jaxrs.model.SelectFieldOption",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the option",
"pattern": "opt_\\d{1,5}",
"example": "opt_1"
},
"value": {
"type": "string",
"description": "Possible value of the custom field",
"example": "Engineering"
},
"default": {
"type": "boolean",
"description": "Indicates that this value is default",
"default": false,
"example": false
}
},
"required": [
"value"
]
}
},
"sortingOrder": {
"type": "string",
"enum": [
"ASC",
"DESC",
"CUSTOM"
],
"description": "Defines sorting order for the custom field",
"example": "ASC",
"default": "CUSTOM"
}
},
"required": [
"values"
]
}
},
"required": [
"multiSelect",
"options"
]
},
"textField": {
"type": "object",
"description": "Text field properties",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Textbox Field Schema",
"additionalProperties": false,
"properties": {
"fieldFormat": {
"type": "string",
"description": "Defines custom field format option",
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"TEXT",
"EMAIL",
"URL",
"NUMBER"
],
"example": "EMAIL",
"default": "TEXT"
}
},
"required": [
"fieldFormat"
]
},
"displayInAccordion": {
"type": "string",
"description": "Display in accordion names for the custom field"
},
"metadata": {
"description": "User metadata information",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata Schema",
"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",
"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": [
"name",
"type",
"entityType"
]
}
Example:
{
"name": "Department",
"refId": "department",
"visible": true,
"required": true,
"helpText": "Provide a department",
"entityType": "package",
"type": "SINGLE_SELECT_DROPDOWN"
}
HTTP status code 204
Item successfully updated
HTTP status code 400
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.
Body
Media type: text/plain
Type: any
Example:
"unable to update custom-field -- malformed JSON at 13:4"
HTTP status code 404
Item with a given ID not found
Body
Media type: text/plain
Type: any
Example:
"custom-field not found"
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
internal server error, contact administrator
Returns usage statistic of custom field with the given id
get /custom-fields/{id}/stats
Returns usage statistic of custom field with the given id
URI Parameters
- id: required(string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
Query Parameters
- lang: (string - default: en - pattern: [a-zA-Z]{2})
Requested language. Optional. [lang=en]
HTTP status code 200
Returns statistic of custom field with the given id
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Custom field statistic",
"additionalProperties": false,
"properties": {
"fieldId": {
"type": "string",
"description": "Unique generated identifier for the custom field",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da"
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field is assigned to",
"example": "package",
"readonly": true
},
"count": {
"type": "integer",
"description": "The number of usages by entity with the particular type",
"example": 3,
"readonly": true
}
},
"required": [
"fieldId",
"entityType",
"count"
]
}
Example:
{
"fieldId": "a772e255-4f75-4742-8735-a8b1a02348d4",
"entityType": "package",
"count": 10
}
HTTP status code 401
Not authorized to perform requested action
Body
Media type: text/plain
Type: any
Example:
Unable to get retrieve statistic -- unauthorized
HTTP status code 404
Custom field with the given id is not found
Body
Media type: text/plain
Type: any
Example:
Custom field not found
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator
Returns usage statistic of custom field option with the given optId
get /custom-fields/{id}/options/{optId}/stats
Returns usage statistic of custom field option with the given optId
URI Parameters
- id: required(string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)
- optId: required(string)
Headers
- X-Okapi-Module-Id: required(string)
The Okapi Module-Id, must be set by the client because all modules that use this library share the CRUD interface POST/PUT/GET/DELETE on /custom-fields and /custom-fields/$id endpoints with Okapi's multiple interfaces feature. For details see Okapi multiples interfaces documentation, folio-custom-fields introduction, and Custom Field backend demo.
Example:
mod-users-19.0.0
HTTP status code 200
Returns usage statistic of custom field option with the given optId
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Custom field option statistic",
"additionalProperties": false,
"properties": {
"optionId": {
"type": "string",
"description": "Unique identifier for the option",
"pattern": "opt_\\d{1,5}",
"example": "opt_1",
"readonly": true
},
"customFieldId": {
"type": "string",
"description": "Custom field ID",
"example": "62d00c36-a94f-434d-9cd2-c7ea159303da",
"readonly": true,
"$schema": "http://json-schema.org/draft-04/schema#",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"entityType": {
"type": "string",
"description": "The entity type, the custom field option is assigned to",
"example": "user",
"readonly": true
},
"count": {
"type": "integer",
"description": "The number of usages by entity with the particular type",
"example": 3,
"readonly": true
}
},
"required": [
"fieldId",
"entityType",
"count"
]
}
Example:
{
"optionId": "opt_1",
"customFieldId": "a772e255-4f75-4742-8735-a8b1a02348d4",
"entityType": "package",
"count": 10
}
HTTP status code 401
Not authorized to perform requested action
Body
Media type: text/plain
Type: any
Example:
Unable to get retrieve statistic -- unauthorized
HTTP status code 404
Custom field with the given id is not found
Body
Media type: text/plain
Type: any
Example:
Custom field not found
HTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator