Sample-Module (v1)

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

Table of contents

Sample Module

CRUD API

/physical

Collection of physical items.

GET /physical

Get list of locationss

GET /physical
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 physical items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "collection of physical records",
  "type": "object",
  "properties": {
    "physicals": {
      "description": "collection of physical records",
      "type": "array",
      "id": "physicals",
      "items": {
        "type": "object",
        "$ref": "physical.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
}

Example:

{
  "physicals":
    [
      {
        "id": "5ee243f9-72e5-4464-bdbc-43a21873d648",
        "volumes": 1,
        "material_supplier": "73d14bc5-d131-48c6-b380-f8e62f63c8b6",
        "receipt_due": "2018-10-10T00:00:00.000Z",
        "po_line_id": "8c778aee-97fa-4586-b131-3ea588a728e2"
      }
    ],
  "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 physical -- 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 physical -- 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 /physical

Create a new physical item.

POST /physical
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 physical material details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this physical details 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}$"
    },
    "material_supplier": {
      "description": "UUID of the material supplier 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}$"
    },
    "receipt_due": {
      "description": "date item should be received by",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "volumes": {
      "description": "the number of volumes included",
      "type": "integer"
    },
    "po_line_id": {
      "description": "UUID of the purchase order line this record is associated with",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "volumes"
  ]
}

Example:

{
  "volumes": 1,
  "material_supplier": "73d14bc5-d131-48c6-b380-f8e62f63c8b6",
  "receipt_due": "2018-10-10T00:00:00.000Z",
  "po_line_id": "8c778aee-97fa-4586-b131-3ea588a728e2"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created physical item

Body

Media type: application/json

Type: any

Example:

{
  "volumes": 1,
  "material_supplier": "73d14bc5-d131-48c6-b380-f8e62f63c8b6",
  "receipt_due": "2018-10-10T00:00:00.000Z",
  "po_line_id": "8c778aee-97fa-4586-b131-3ea588a728e2"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

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

Retrieve physical item with given {physicalId}

GET /physical/{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 physical material details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this physical details 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}$"
    },
    "material_supplier": {
      "description": "UUID of the material supplier 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}$"
    },
    "receipt_due": {
      "description": "date item should be received by",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "volumes": {
      "description": "the number of volumes included",
      "type": "integer"
    },
    "po_line_id": {
      "description": "UUID of the purchase order line this record is associated with",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "volumes"
  ]
}

Example:

{
  "id": "5ee243f9-72e5-4464-bdbc-43a21873d648",
  "volumes": 1,
  "material_supplier": "73d14bc5-d131-48c6-b380-f8e62f63c8b6",
  "receipt_due": "2018-10-10T00:00:00.000Z",
  "po_line_id": "8c778aee-97fa-4586-b131-3ea588a728e2"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Delete physical item with given {physicalId}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Update physical item with given {physicalId}

PUT /physical/{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 physical material details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this physical details 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}$"
    },
    "material_supplier": {
      "description": "UUID of the material supplier 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}$"
    },
    "receipt_due": {
      "description": "date item should be received by",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "volumes": {
      "description": "the number of volumes included",
      "type": "integer"
    },
    "po_line_id": {
      "description": "UUID of the purchase order line this record is associated with",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "volumes"
  ]
}

Example:

{
  "id": "5ee243f9-72e5-4464-bdbc-43a21873d648",
  "volumes": 1,
  "material_supplier": "73d14bc5-d131-48c6-b380-f8e62f63c8b6",
  "receipt_due": "2018-10-10T00:00:00.000Z",
  "po_line_id": "8c778aee-97fa-4586-b131-3ea588a728e2"
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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