Material Types API v2.2 Documentation

Material Types API

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

Endpoints

http://localhost

/material-types

Description

Collection of material-type items.

get

Description

Return a list of material types

Request Headers

Authorization string required

Used to send a valid JWT token.

Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Query Parameters

offset integer
Maximum: 2147483647

Skip over a number of elements by specifying an offset value for the query

limit integer
Default: 10 Maximum: 2147483647

Limit the number of elements returned in the response

Example: 10
query string

A query expressed as a CQL string (see dev.folio.org/doc/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 name=aaa
lang string
Default: en Pattern: [a-zA-Z]{2}

Requested language. Optional. [lang=en]

Responses

200 OK

Returns a list of material-type items

Response Example (application/json)
{
  "mtypes": [
    {
      "name": "book"
    },
    {
      "name": "dvd"
    }
  ],
  "totalRecords": 2
}

400 Bad Request

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.

Response Example (text/plain)
unable to list material-types -- malformed parameter 'query', syntax error at column 6

401 Unauthorized

Not authorized to perform requested action

Response Example (text/plain)
unable to list material-types -- unauthorized

403 Forbidden

Access denied, not valid privilege in resources

Response Example (text/plain)
Unauthorized

500 Internal Server Error

Internal server error, e.g. due to misconfiguration

Response Example (text/plain)
internal server error, contact administrator

post

Description

Create a new material type

Request Headers

Authorization string required

Used to send a valid JWT token.

Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Query Parameters

lang string
Default: en Pattern: [a-zA-Z]{2}

Requested language. Optional. [lang=en]

Request JSON Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Request Example (application/json)

{
  "name": "book"
}

Responses

201 Created

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

Response Headers

Location string

URI to the created material-type item

Response Example (application/json)
{
  "name": "book"
}

400 Bad Request

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.

Response Example (text/plain)
"unable to add material-type -- malformed JSON at 13:3"

401 Unauthorized

Not authorized to perform requested action

Response Example (text/plain)
unable to create material-types -- unauthorized

403 Forbidden

Access denied, not valid privilege in resources

Response Example (text/plain)
Unauthorized

422 Unprocessable Entity (WebDAV; RFC 4918)

Validation errors

Response Example (application/json)
{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

500 Internal Server Error

Internal server error, e.g. due to misconfiguration

Response Example (text/plain)
Internal server error, contact administrator

delete

Description

Delete all material types

Responses

204 No Content

All material types deleted

500 Internal Server Error

Internal server error, e.g. due to misconfiguration

Response Example (text/plain)
Internal server error, contact administrator

/material-types/{materialtypeId}

Description

Pass in the MT code

URI Parameters

materialtypeId string required

get

Description

Retrieve material-type item with given {material-typeId}

Request Headers

Authorization string required

Used to send a valid JWT token.

Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Query Parameters

lang string
Default: en Pattern: [a-zA-Z]{2}

Requested language. Optional. [lang=en]

Responses

200 OK

Returns item with a given ID

Response Example (application/json)
{
  "name": "book"
}

401 Unauthorized

No valid token found

Response Example (text/plain)
Unauthorized

403 Forbidden

Access denied, not valid privilege in resources

Response Example (text/plain)
Unauthorized

404 Not Found

Item with a given ID not found

Response Example (text/plain)
"material-type not found"

500 Internal Server Error

Internal server error, e.g. due to misconfiguration

Response Example (text/plain)
internal server error, contact administrator

delete

Description

Delete material-type item with given {material-typeId}

Request Headers

Authorization string required

Used to send a valid JWT token.

Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Query Parameters

lang string
Default: en Pattern: [a-zA-Z]{2}

Requested language. Optional. [lang=en]

Responses

204 No Content

Item deleted successfully

400 Bad Request

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.

Response Example (text/plain)
"unable to delete material-type -- constraint violation"

401 Unauthorized

No valid token found

Response Example (text/plain)
Unauthorized

403 Forbidden

Access denied, not valid privilege in resources

Response Example (text/plain)
Unauthorized

404 Not Found

Item with a given ID not found

Response Example (text/plain)
"material-type not found"

500 Internal Server Error

Internal server error, e.g. due to misconfiguration

Response Example (text/plain)
Internal server error, contact administrator

put

Description

Update material-type item with given {material-typeId}

Request Headers

Authorization string required

Used to send a valid JWT token.

Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Query Parameters

lang string
Default: en Pattern: [a-zA-Z]{2}

Requested language. Optional. [lang=en]

Request JSON Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Request Example (application/json)

{
  "name": "book"
}

Responses

204 No Content

Item successfully updated

400 Bad Request

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.

Response Example (text/plain)
"unable to update material-type -- malformed JSON at 13:4"

401 Unauthorized

No valid token found

Response Example (text/plain)
Unauthorized

403 Forbidden

Access denied, not valid privilege in resources

Response Example (text/plain)
Unauthorized

404 Not Found

Item with a given ID not found

Response Example (text/plain)
"material-type not found"

500 Internal Server Error

Internal server error, e.g. due to misconfiguration

Response Example (text/plain)
internal server error, contact administrator