Comments (v1)

http://github.com/org/folio/mod-feesfines

Table of contents

Comments API

This documents the API calls that can be made to query and manage feefine of the system

/comments

Collection of comment items.

GET /comments

Return a list of comments

GET /comments
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

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    active=true
    
  • orderBy: (string)

    Order by field: field A, field B

  • order: (one of desc, asc - default: desc)

    Order

  • 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
  • facets: (array of string)

    facets to return in the collection result set, can be suffixed by a count of facet values to return, for example, patronGroup:10 default to top 5 facet values

  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of comment items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "comments": {
      "type": "array",
      "id": "commentsData",
      "items": {
        "type": "object",
        "$ref": "commentdata.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    },
    "resultInfo":{
      "$ref": "raml-util/schemas/resultInfo.schema",
      "readonly":true
    }
  },
  "required": [
    "comments",
    "totalRecords"
  ]
}

Example:

{
  "comments" : [ {
    "paid": false,
    "waived": true,
    "refunded": true,
    "transferredManually": true,
    "metadata": {
      "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
      "createdDate": "2018-01-31T21:21:02Z"
    },
    "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434371"
  }, {
    "paid": false,
    "waived": true,
    "refunded": true,
    "transferredManually": true,
    "metadata": {
      "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
      "createdDate": "2018-01-31T21:21:02Z"
    },
    "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434372"
  } ],
  "totalRecords" : 2
}

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 comments -- 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 comments -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /comments

Create a comment

POST /comments
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#",
  "title": "Accounts Schema",
  "type": "object",
  "properties": {
    "paid": {
      "type": "boolean"
    },
    "waived": {
      "type": "boolean"
    },
    "refunded": {
      "type": "boolean"
    },
    "transferredManually": {
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "id"
   ]
}

Example:

{
  "paid": false,
  "waived": true,
  "refunded": true,
  "transferredManually": true,
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-05-22T21:21:02Z"
  },
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434371"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created comment item

Body

Media type: application/json

Type: any

Example:

{
  "paid": false,
  "waived": true,
  "refunded": true,
  "transferredManually": true,
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-05-22T21:21:02Z"
  },
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434371"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create comments -- 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 /comments/{commentId}

Get a single comment

GET /comments/{commentId}
URI Parameters
  • commentId: 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#",
  "title": "Accounts Schema",
  "type": "object",
  "properties": {
    "paid": {
      "type": "boolean"
    },
    "waived": {
      "type": "boolean"
    },
    "refunded": {
      "type": "boolean"
    },
    "transferredManually": {
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "id"
   ]
}

Example:

{
  "paid": false,
  "waived": true,
  "refunded": true,
  "transferredManually": true,
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-05-22T21:21:02Z"
  },
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434371"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"comment not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /comments/{commentId}

Delete comment item with given {commentId}

DELETE /comments/{commentId}
URI Parameters
  • commentId: 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, 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 comment -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"comment not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

PUT /comments/{commentId}

Update comment item with given {commentId}

PUT /comments/{commentId}
URI Parameters
  • commentId: 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#",
  "title": "Accounts Schema",
  "type": "object",
  "properties": {
    "paid": {
      "type": "boolean"
    },
    "waived": {
      "type": "boolean"
    },
    "refunded": {
      "type": "boolean"
    },
    "transferredManually": {
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "id"
   ]
}

Example:

{
  "paid": false,
  "waived": true,
  "refunded": true,
  "transferredManually": true,
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-05-22T21:21:02Z"
  },
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434371"
}

Response 204

Item successfully updated

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 update comment -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"comment not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator