User import (v1)

https://github.com/folio-org/mod-user-import

Table of contents

mod-user-import API

This documents the API calls that can be made to import users into the system

/user-import

POST /user-import

Create or update a list of users

POST /user-import
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "users": {
      "type": "array",
      "id": "usersData",
      "items": {
        "type": "object",
        "$ref": "userdataimport.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    },
    "deactivateMissingUsers": {
      "type": "boolean"
    },
    "updateOnlyPresentFields": {
      "type": "boolean"
    },
    "sourceType": {
      "type": "string"
    }
  },
  "required": [
    "users",
    "totalRecords"
  ]
}

Example:

{
  "users": [
    {
      "username": "jhandey",
      "externalSystemId": "111_112",
      "barcode": "1234567",
      "active": true,
      "patronGroup": "4bb563d9-3f9d-4e1e-8d1d-04e75666d68f",
      "meta": {
        "creation_date": "2016-11-05T0723",
        "last_login_date": ""
      },
      "personal": {
        "lastName": "Handey",
        "firstName": "Jack",
        "middleName": "Michael",
        "dateOfBirth": "1965-07-08T00:00:01Z",
        "phone": "+1 (212) 567-8912",
        "mobilePhone": "+1 (212) 678-9123",
        "email": "jhandey@biglibrary.org"
      },
      "customFields": {
        "scope_1": "Design"
      }
    }
  ],
  "totalRecords": 1,
  "deactivateMissingUsers": true,
  "updateOnlyPresentFields": false,
  "sourceType": "source1"
}

Response 200

Return OK

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Import response",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    },
    "error": {
      "type": "string"
    },
    "createdRecords": {
      "type": "integer"
    },
    "updatedRecords": {
      "type": "integer"
    },
    "failedRecords": {
      "type": "integer"
    },
    "failedUsers": {
      "type": "array",
      "id": "failedUsers",
      "items": {
        "type": "object",
        "$ref": "failedUserdata.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "message",
    "totalRecords"
  ]
}

Response 500

Internal server error

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Import response",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    },
    "error": {
      "type": "string"
    },
    "createdRecords": {
      "type": "integer"
    },
    "updatedRecords": {
      "type": "integer"
    },
    "failedRecords": {
      "type": "integer"
    },
    "failedUsers": {
      "type": "array",
      "id": "failedUsers",
      "items": {
        "type": "object",
        "$ref": "failedUserdata.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "message",
    "totalRecords"
  ]
}