Notes API (v1)

https://github.com/folio-org/mod-notes

Table of contents

mod-notes API

This documents the API calls that can be made to query and manage notes about all kind of objects

Notes

Notes collection

POST /notes

Create a new note item.

POST /notes
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": "Notes about all kind of objects",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string"
    },
    "link": {
      "type": "string",
      "description": "Link to the item the note refers to",
      "example": "/items/1234-567890"
    },
    "text": {
      "type": "string",
      "description": "The text of the note"
    },
    "domain": {
      "type": "string",
      "description": "Domain the note belongs to. Used for permissions like notes.domain.items",
      "example": "items"
    },
    "creatorUserName": {
      "type": "string",
      "description": "username of the user who created the note",
      "example": "johndoe17",
      "readonly": true
    },
    "creatorLastName": {
      "type": "string",
      "description": "Last name of the user who created the note",
      "example": "Doe",
      "readonly": true
    },
    "creatorFirstName": {
      "type": "string",
      "description": "First name of the user who created the note",
      "example": "John",
      "readonly": true
    },
    "creatorMiddleName": {
      "type": "string",
      "description": "Middle name or initial of the user who created the note",
      "example": "X.",
      "readonly": true
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "link",
    "text"
  ]
}

Example:

{
  "id": "12345",
  "link": "users/45678",
  "text": "Strange fellow"
}

Response 201

Returns a newly created item, with server-controlled fields like 'id' populated

Headers
  • Location: required (string)

    URI to the created note item

Body

Media type: application/json

Type: any

Example:

{
  "id": "12345",
  "link": "users/45678",
  "text": "Strange fellow"
}

Response 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 note -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create notes -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /notes

Retrieve a list of note items.

GET /notes
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.

    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: (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]

Response 200

Returns a list of note items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Collection of notes",
  "properties": {
    "notes": {
      "description": "Collection of notes",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "note.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "notes",
    "totalRecords"
  ]
}

Example:

{
  "notes": [
    {
      "id": "12345",
      "link": "users/45678",
      "text": "Strange fellow"
    }
  ],
  "totalRecords": 1
}

Response 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 notes -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to list notes -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

GET /notes/_self

Retrieve a list of _self items.

GET /notes/_self
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.

    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: (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]

Response 200

Returns a list of _self items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Collection of notes",
  "properties": {
    "notes": {
      "description": "Collection of notes",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "note.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "notes",
    "totalRecords"
  ]
}

Example:

{
  "notes": [
    {
      "id": "12345",
      "link": "users/45678",
      "text": "Strange fellow"
    }
  ],
  "totalRecords": 1
}

Response 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 _self -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to list _self -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /notes/_self

Create a new _self item.

POST /notes/_self
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": "Notes about all kind of objects",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string"
    },
    "link": {
      "type": "string",
      "description": "Link to the item the note refers to",
      "example": "/items/1234-567890"
    },
    "text": {
      "type": "string",
      "description": "The text of the note"
    },
    "domain": {
      "type": "string",
      "description": "Domain the note belongs to. Used for permissions like notes.domain.items",
      "example": "items"
    },
    "creatorUserName": {
      "type": "string",
      "description": "username of the user who created the note",
      "example": "johndoe17",
      "readonly": true
    },
    "creatorLastName": {
      "type": "string",
      "description": "Last name of the user who created the note",
      "example": "Doe",
      "readonly": true
    },
    "creatorFirstName": {
      "type": "string",
      "description": "First name of the user who created the note",
      "example": "John",
      "readonly": true
    },
    "creatorMiddleName": {
      "type": "string",
      "description": "Middle name or initial of the user who created the note",
      "example": "X.",
      "readonly": true
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "link",
    "text"
  ]
}

Example:

{
  "id": "12345",
  "link": "users/45678",
  "text": "Strange fellow"
}

Response 201

Returns a newly created item, with server-controlled fields like 'id' populated

Headers
  • Location: required (string)

    URI to the created _self item

Body

Media type: application/json

Type: any

Example:

{
  "id": "12345",
  "link": "users/45678",
  "text": "Strange fellow"
}

Response 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 _self -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create _self -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /notes/{id}

Retrieve note item with given {noteId}

GET /notes/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 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": "Notes about all kind of objects",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string"
    },
    "link": {
      "type": "string",
      "description": "Link to the item the note refers to",
      "example": "/items/1234-567890"
    },
    "text": {
      "type": "string",
      "description": "The text of the note"
    },
    "domain": {
      "type": "string",
      "description": "Domain the note belongs to. Used for permissions like notes.domain.items",
      "example": "items"
    },
    "creatorUserName": {
      "type": "string",
      "description": "username of the user who created the note",
      "example": "johndoe17",
      "readonly": true
    },
    "creatorLastName": {
      "type": "string",
      "description": "Last name of the user who created the note",
      "example": "Doe",
      "readonly": true
    },
    "creatorFirstName": {
      "type": "string",
      "description": "First name of the user who created the note",
      "example": "John",
      "readonly": true
    },
    "creatorMiddleName": {
      "type": "string",
      "description": "Middle name or initial of the user who created the note",
      "example": "X.",
      "readonly": true
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "link",
    "text"
  ]
}

Example:

{
  "id": "12345",
  "link": "users/45678",
  "text": "Strange fellow"
}

Response 400

Bad request

Body

Media type: text/plain

Type: any

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"note not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

PUT /notes/{id}

Update note item with given {noteId}

PUT /notes/{id}
URI Parameters
  • id: required (string)
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": "Notes about all kind of objects",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string"
    },
    "link": {
      "type": "string",
      "description": "Link to the item the note refers to",
      "example": "/items/1234-567890"
    },
    "text": {
      "type": "string",
      "description": "The text of the note"
    },
    "domain": {
      "type": "string",
      "description": "Domain the note belongs to. Used for permissions like notes.domain.items",
      "example": "items"
    },
    "creatorUserName": {
      "type": "string",
      "description": "username of the user who created the note",
      "example": "johndoe17",
      "readonly": true
    },
    "creatorLastName": {
      "type": "string",
      "description": "Last name of the user who created the note",
      "example": "Doe",
      "readonly": true
    },
    "creatorFirstName": {
      "type": "string",
      "description": "First name of the user who created the note",
      "example": "John",
      "readonly": true
    },
    "creatorMiddleName": {
      "type": "string",
      "description": "Middle name or initial of the user who created the note",
      "example": "X.",
      "readonly": true
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "link",
    "text"
  ]
}

Example:

{
  "id": "12345",
  "link": "users/45678",
  "text": "Strange fellow"
}

Response 204

Item successfully updated

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

"unable to update note -- malformed JSON at 13:4"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"note not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /notes/{id}

Delete note item with given {noteId}

DELETE /notes/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 204

Item deleted successfully

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

"unable to delete note -- constraint violation"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"note not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator