Sample-Module (v1)

http://github.com/org/folio/sample-module

Table of contents

mod-orders (Reporting Code)

CRUD APIs used to manage reporting codes.

/reporting_code

Collection of reporting_code items.

GET /reporting_code

Get list of renewals

GET /reporting_code
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 code

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    ["code", "MEDGRANT", "="]
    
  • 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 reporting_code items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "collection of reporting code records",
  "type": "object",
  "properties": {
    "reporting_codes": {
      "description": "collection of reporting code records",
      "type": "array",
      "id": "reporting_codes",
      "items": {
        "type": "object",
        "$ref": "reporting_code.json"
      }
    },
    "total_records": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    },
    "first": {
      "description": "The index of the first object contained in this collection",
      "type": "integer"
    },
    "last": {
      "description": "The index of the last object contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "reporting_codes",
    "total_records"
  ]
}

Example:

{
  "reporting_codes":
    [
      {
        "id": "5926dcd7-85f5-4504-8283-712595ebc38b",
        "code": "CODE1",
        "description": "ABCDEF"
      }
    ],
  "total_records": 1,
  "first": 1,
  "last": 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 reporting_code -- 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 reporting_code -- 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 /reporting_code

Create a new reporting_code item.

POST /reporting_code
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#",
  "description": "purchase order line reporting code",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this reporting code record",
      "type": "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}$"
    },
    "code": {
      "description": "a reporting code",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{4}[a-zA-Z0-9]*$"
    },
    "description": {
      "description": "description of this reporting code",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "code"
  ]
}

Example:

{
  "code": "CODE1",
  "description": "ABCDEF"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created reporting_code item

Body

Media type: application/json

Type: any

Example:

{
  "code": "CODE1",
  "description": "ABCDEF"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create reporting_code -- 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 /reporting_code/{id}

Retrieve reporting_code item with given {reporting_codeId}

GET /reporting_code/{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#",
  "description": "purchase order line reporting code",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this reporting code record",
      "type": "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}$"
    },
    "code": {
      "description": "a reporting code",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{4}[a-zA-Z0-9]*$"
    },
    "description": {
      "description": "description of this reporting code",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "code"
  ]
}

Example:

{
  "code": "CODE1",
  "description": "ABCDEF"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"reporting_code 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 /reporting_code/{id}

Delete reporting_code item with given {reporting_codeId}

DELETE /reporting_code/{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, 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 reporting_code -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"reporting_code 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 /reporting_code/{id}

Update reporting_code item with given {reporting_codeId}

PUT /reporting_code/{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#",
  "description": "purchase order line reporting code",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this reporting code record",
      "type": "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}$"
    },
    "code": {
      "description": "a reporting code",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{4}[a-zA-Z0-9]*$"
    },
    "description": {
      "description": "description of this reporting code",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "code"
  ]
}

Example:

{
  "code": "CODE1",
  "description": "ABCDEF"
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"reporting_code 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