User tenants

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

Table of contents

mod-users User tenants API

Records that show the primary tenant for a user when doing single-sign-on

/user-tenants

Collection of user-tenant items.

GET /user-tenants

Return a list of user tenants

GET /user-tenants
Query Parameters
  • userId: (string)

    Filter by user id

    Example:

    11484f66-5121-43ea-81e7-6d9e3711495f
  • username: (string)

    Filter by user name

    Example:

    folio_user
  • tenantId: (string)

    Filter by tenant id

    Example:

    sfs000
  • email: (string)

    Filter by email

    Example:

    test@mail.com
  • phoneNumber: (string)

    Filter by mobile number

    Example:

    12345676
  • mobilePhoneNumber: (string)

    Filter by mobile phone number

    Example:

    123456789
  • barcode: (string)

    Filter by barcode

    Example:

    925162037753924
  • externalSystemId: (string)

    Filter by externalSystemId

    Example:

    945d62d8-702c-4ed1-a16b-83146a6d8eef
  • queryOp: required (string - default: and)

    Query operation for searching

  • totalRecords: (string - default: auto - pattern: exact|estimated|none|auto)

    How to calculate the totalRecords property. "exact" for the correct number, "estimated" for an estimation, "auto" to automatically select "exact" or "estimated", "none" for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords

    Example:

    none
  • 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

Response 200

Returns a list of user-tenant items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Collection of primary tenant records",
  "properties": {
    "userTenants": {
      "description": "List of primary tenant records",
      "type": "array",
      "id": "userTenants",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Primary tenant of a user used for single-sign-on",
        "properties": {
          "id": {
            "description": "UUID of the user tenant",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "uuid.schema",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          },
          "userId": {
            "description": "UUID of the user",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "uuid.schema",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          },
          "username": {
            "description": "The user name",
            "type": "string"
          },
          "tenantId": {
            "description": "Primary tenant of the user for single-sign-on",
            "type": "string"
          },
          "centralTenantId": {
            "description": "Central tenant id in the consortium",
            "type": "string"
          },
          "phoneNumber": {
            "description": "The user's primary phone number",
            "type": "string"
          },
          "mobilePhoneNumber": {
            "description": "The user's mobile phone number",
            "type": "string"
          },
          "email": {
            "description": "The user's email address",
            "type": "string"
          },
          "barcode": {
            "description": "The barcode of the user's",
            "type": "string"
          },
          "externalSystemId": {
            "description": "The externalSystemId of the user's",
            "type": "string"
          },
          "consortiumId": {
            "description": "UUID of the consortiumId",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "uuid.schema",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          }
        },
        "additionalProperties": false,
        "required": [
          "userId",
          "tenantId"
        ]
      }
    },
    "totalRecords": {
      "type": "integer",
      "description": "Estimated or exact total number of records, see https://github.com/folio-org/raml-module-builder#estimated-totalrecords for details"
    }
  },
  "required": [
    "userTenants",
    "totalRecords"
  ]
}

Example:

{
  "userTenants": [
    {
      "id": "0d6a9156-25b9-4bee-ab4d-dbb31afba0bd",
      "userId": "11484f66-5121-43ea-81e7-6d9e3711495f",
      "username": "folio_user",
      "tenantId": "sfs000"
    }
  ],
  "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 user-tenants -- 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 user-tenants -- unauthorized

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

POST /user-tenants

Create a user-tenant

POST /user-tenants
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Primary tenant of a user used for single-sign-on",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of the user tenant",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "userId": {
      "description": "UUID of the user",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "username": {
      "description": "The user name",
      "type": "string"
    },
    "tenantId": {
      "description": "Primary tenant of the user for single-sign-on",
      "type": "string"
    },
    "centralTenantId": {
      "description": "Central tenant id in the consortium",
      "type": "string"
    },
    "phoneNumber": {
      "description": "The user's primary phone number",
      "type": "string"
    },
    "mobilePhoneNumber": {
      "description": "The user's mobile phone number",
      "type": "string"
    },
    "email": {
      "description": "The user's email address",
      "type": "string"
    },
    "barcode": {
      "description": "The barcode of the user's",
      "type": "string"
    },
    "externalSystemId": {
      "description": "The externalSystemId of the user's",
      "type": "string"
    },
    "consortiumId": {
      "description": "UUID of the consortiumId",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "userId",
    "tenantId"
  ]
}

Example:

{
  "id": "0d6a9156-25b9-4bee-ab4d-dbb31afba0bd",
  "userId": "11484f66-5121-43ea-81e7-6d9e3711495f",
  "username": "folio_user",
  "tenantId": "sfs000"
}

Response 201

Returns only 201 status code without body

Headers
  • Location: required (string)

    URI to the created user-tenant item

Body

Media type: application/json

Type: any

Example:

{
  "id": "0d6a9156-25b9-4bee-ab4d-dbb31afba0bd",
  "userId": "11484f66-5121-43ea-81e7-6d9e3711495f",
  "username": "folio_user",
  "tenantId": "sfs000"
}

Response 400

Bad request, e.g. malformed request body. Details of the error provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to add user-tenant -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create user-tenants -- unauthorized

Response 422

Validation error, e.g. missing required field. Details of the error provided in the response.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "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

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

DELETE /user-tenants

Delete a user-tenant from member tenant. Deleting from the central tenant is forbidden.

DELETE /user-tenants
Query Parameters
  • tenantId: (string)

    Filter by tenant id

    Example:

    sfs000

Response 204

Successful deletion

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error