Address Types (v1.0.1)

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

Table of contents

mod-users Address Types API

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

/addresstypes

Collection of addresstype items.

GET /addresstypes

Return a list of address types

GET /addresstypes
Query Parameters
  • query: (string)

    JSON array [{"field1","value1","operator1"},{"field2","value2","operator2"},...,{"fieldN","valueN","operatorN"}]

    Example:

    addressType=primary
    
  • 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 addresstype items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Collection of address types",
  "properties": {
    "addressTypes": {
      "description": "List of address type items",
      "type": "array",
      "id": "addressType",
      "items": {
        "type": "object",
        "$ref": "addresstype.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "addressTypes",
    "totalRecords"
  ]
}

Example:

{
  "addressTypes": [
    {
      "addressType": "primary",
      "desc": "The patron's primary residence",
      "id": "b4b5e97a-0a99-4db9-97df-4fdf406ec74d"
    }
  ],
  "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 addresstypes -- 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 addresstypes -- 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 /addresstypes

Create an address type

POST /addresstypes
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": "Address Type Schema",
  "description": "An address type",
  "type": "object",
  "properties": {
    "addressType": {
      "description": "A unique name for this address type",
      "type": "string"
    },
    "desc": {
      "description": "An explanation of this address type",
      "type": "string"
    },
    "id": {
      "description": "A UUID identifying this address type",
      "type": "string"
    },
    "metadata" : {
      "$ref" : "raml-util/schemas/metadata.schema",
      "readonly" : true
    }
  },
  "additionalProperties": false,
  "required" : [ "addressType" ]
}

Example:

{
  "addressType": "primary",
  "desc": "The patron's primary residence",
  "id": "b4b5e97a-0a99-4db9-97df-4fdf406ec74d"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created addresstype item

Body

Media type: application/json

Type: any

Example:

{
  "addressType": "primary",
  "desc": "The patron's primary residence",
  "id": "b4b5e97a-0a99-4db9-97df-4fdf406ec74d"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create addresstypes -- 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 /addresstypes/{addresstypeId}

Retrieve addresstype item with given {addresstypeId}

GET /addresstypes/{addresstypeId}
URI Parameters
  • addresstypeId: 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": "Address Type Schema",
  "description": "An address type",
  "type": "object",
  "properties": {
    "addressType": {
      "description": "A unique name for this address type",
      "type": "string"
    },
    "desc": {
      "description": "An explanation of this address type",
      "type": "string"
    },
    "id": {
      "description": "A UUID identifying this address type",
      "type": "string"
    },
    "metadata" : {
      "$ref" : "raml-util/schemas/metadata.schema",
      "readonly" : true
    }
  },
  "additionalProperties": false,
  "required" : [ "addressType" ]
}

Example:

{
  "addressType": "primary",
  "desc": "The patron's primary residence",
  "id": "b4b5e97a-0a99-4db9-97df-4fdf406ec74d"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"addresstype 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 /addresstypes/{addresstypeId}

Delete addresstype item with given {addresstypeId}

DELETE /addresstypes/{addresstypeId}
URI Parameters
  • addresstypeId: 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 addresstype -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"addresstype 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 /addresstypes/{addresstypeId}

Update addresstype item with given {addresstypeId}

PUT /addresstypes/{addresstypeId}
URI Parameters
  • addresstypeId: 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": "Address Type Schema",
  "description": "An address type",
  "type": "object",
  "properties": {
    "addressType": {
      "description": "A unique name for this address type",
      "type": "string"
    },
    "desc": {
      "description": "An explanation of this address type",
      "type": "string"
    },
    "id": {
      "description": "A UUID identifying this address type",
      "type": "string"
    },
    "metadata" : {
      "$ref" : "raml-util/schemas/metadata.schema",
      "readonly" : true
    }
  },
  "additionalProperties": false,
  "required" : [ "addressType" ]
}

Example:

{
  "addressType": "primary",
  "desc": "The patron's primary residence",
  "id": "b4b5e97a-0a99-4db9-97df-4fdf406ec74d"
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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