Organizations (v1.1)

https://github.com/folio-org/mod-organizations-storage

Table of contents

Deprecated. Addresses

CRUD APIs used to manage addresses. These APIs are not currently in use and may at some point be removed or resurrected

/organizations-storage/addresses

Collection of address items.

GET /organizations-storage/addresses

Get list of addresses

GET /organizations-storage/addresses
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 address items

Body

Media type: application/json

Type: json

Content:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Collection of address records",
    "type": "object",
    "properties": {
      "addresses": {
        "description": "The list of addresses in this collection",
        "type": "array",
        "id": "addresses",
        "items": {
          "type": "object",
          "$ref": "address.json"
        }
      },
      "totalRecords": {
        "description": "The number of address records returned in this collection",
        "type": "integer"
      }
    },
    "additionalProperties": false,
    "required": [
      "addresses",
      "totalRecords"
    ]
  }

Example:

{
    "addresses": [
        {
            "id": "588b5c42-8634-4af7-bc9b-5e0116ed96b6",
            "addressLine1": "10 Estes Street",
            "addressLine2": "",
            "city": "Ipswich",
            "stateRegion": "MA",
            "zipCode": "01938",
            "country": "USA",
            "metadata": {
                  "createdDate": "2019-06-19T00:00:00.000+0000",
                  "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
            }
        }
    ],
    "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 addresses -- 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 addresses -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "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

POST /organizations-storage/addresses

Create a new address item.

POST /organizations-storage/addresses
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": "An address record",
  "type": "object",
  "properties": {
    "id": {
      "type": ["string", "null"],
      "description": "UUID",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
    },
    "addressLine1": {
      "description": "The first line of this address",
      "type": "string"
    },
    "addressLine2": {
      "description": "The second line of this address",
      "type": "string"
    },
    "city": {
      "description": "The city for this address",
      "type": "string"
    },
    "stateRegion": {
      "description": "The state or region for this address",
      "type": "string"
    },
    "zipCode": {
      "description": "The zip code for this address",
      "type": "string"
    },
    "country": {
      "description": "The country for this address",
      "type": "string"
    },
    "isPrimary": {
      "description": "Used to set this address as primary for the contact",
      "type": "boolean"
    },
    "categories": {
      "id": "categories",
      "description": "The list of categories for this organization address",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "language": {
      "description": "The language for this organization address",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false
}

Example:

{
    "addressLine1": "10 Estes Street",
    "addressLine2": "",
    "city": "Ipswich",
    "stateRegion": "MA",
    "zipCode": "01938",
    "country": "USA"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created address item

Body

Media type: application/json

Type: any

Example:

{
    "addressLine1": "10 Estes Street",
    "addressLine2": "",
    "city": "Ipswich",
    "stateRegion": "MA",
    "zipCode": "01938",
    "country": "USA"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create addresses -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "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 /organizations-storage/addresses/{id}

Retrieve address item with given {addressId}

GET /organizations-storage/addresses/{id}
URI Parameters
  • id: required (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}$)

    The UUID of a Address

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": "An address record",
  "type": "object",
  "properties": {
    "id": {
      "type": ["string", "null"],
      "description": "UUID",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
    },
    "addressLine1": {
      "description": "The first line of this address",
      "type": "string"
    },
    "addressLine2": {
      "description": "The second line of this address",
      "type": "string"
    },
    "city": {
      "description": "The city for this address",
      "type": "string"
    },
    "stateRegion": {
      "description": "The state or region for this address",
      "type": "string"
    },
    "zipCode": {
      "description": "The zip code for this address",
      "type": "string"
    },
    "country": {
      "description": "The country for this address",
      "type": "string"
    },
    "isPrimary": {
      "description": "Used to set this address as primary for the contact",
      "type": "boolean"
    },
    "categories": {
      "id": "categories",
      "description": "The list of categories for this organization address",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "language": {
      "description": "The language for this organization address",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false
}

Example:

{
    "id": "588b5c42-8634-4af7-bc9b-5e0116ed96b6",
    "addressLine1": "10 Estes Street",
    "addressLine2": "",
    "city": "Ipswich",
    "stateRegion": "MA",
    "zipCode": "01938",
    "country": "USA",
    "metadata": {
        "createdDate": "2019-06-19T00:00:00.000+0000",
        "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
    }
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"address not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "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

DELETE /organizations-storage/addresses/{id}

Delete address item with given {addressId}

DELETE /organizations-storage/addresses/{id}
URI Parameters
  • id: required (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}$)

    The UUID of a Address

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 address -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"address not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "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

PUT /organizations-storage/addresses/{id}

Update address item with given {addressId}

PUT /organizations-storage/addresses/{id}
URI Parameters
  • id: required (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}$)

    The UUID of a Address

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": "An address record",
  "type": "object",
  "properties": {
    "id": {
      "type": ["string", "null"],
      "description": "UUID",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
    },
    "addressLine1": {
      "description": "The first line of this address",
      "type": "string"
    },
    "addressLine2": {
      "description": "The second line of this address",
      "type": "string"
    },
    "city": {
      "description": "The city for this address",
      "type": "string"
    },
    "stateRegion": {
      "description": "The state or region for this address",
      "type": "string"
    },
    "zipCode": {
      "description": "The zip code for this address",
      "type": "string"
    },
    "country": {
      "description": "The country for this address",
      "type": "string"
    },
    "isPrimary": {
      "description": "Used to set this address as primary for the contact",
      "type": "boolean"
    },
    "categories": {
      "id": "categories",
      "description": "The list of categories for this organization address",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "language": {
      "description": "The language for this organization address",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false
}

Example:

{
    "id": "588b5c42-8634-4af7-bc9b-5e0116ed96b6",
    "addressLine1": "10 Estes Street",
    "addressLine2": "",
    "city": "Ipswich",
    "stateRegion": "MA",
    "zipCode": "01938",
    "country": "USA",
    "metadata": {
        "createdDate": "2019-06-19T00:00:00.000+0000",
        "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
    }
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"address not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "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