foliolib.folio.api.userImport.Import

class foliolib.folio.api.userImport.Import(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

mod-user-import API

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

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

set_userImport(userImport)

Create or update a list of users

set_userImport(userImport: dict)

Create or update a list of users

POST /user-import

Parameters

userImport (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises

OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "User Data Import Collection Schema",
  "description": "The user data import collection",
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "users": {
      "id": "usersData",
      "type": "array",
      "description": "List of users' data to import",
      "items": {
        "type": "object",
        "$ref": "userdataimport.json"
      }
    },
    "totalRecords": {
      "description": "Total number of users' data to import",
      "type": "integer"
    },
    "deactivateMissingUsers": {
      "description": "Indicates whether to deactivate users that missing in current users' data collection",
      "type": "boolean"
    },
    "updateOnlyPresentFields": {
      "description": "Indicates whether to update only present fields in user's data. Currently this only works for addresses.",
      "type": "boolean"
    },
    "sourceType": {
      "description": "A prefix for the externalSystemId",
      "type": "string"
    },
    "included": {
      "description": "Entities that should be imported with users",
      "javaType": "org.folio.rest.jaxrs.model.IncludedObjects",
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "departments": {
          "description": "Departments entities that should be imported with users",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "object",
            "$ref": "department.json"
          }
        },
        "customFields": {
          "description": "Custom fields entities that should be updated with users",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "object",
            "$ref": "customField.json"
          }
        }
      }
    }
  },
  "required": [
    "users",
    "totalRecords"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Import Response Schema",
  "description": "The response of the import",
  "type": "object",
  "properties": {
    "message": {
      "description": "Message stating that the import was successful or failed or the users were deactivated",
      "type": "string"
    },
    "error": {
      "description": "Error message stating why the import was failed",
      "type": "string"
    },
    "createdRecords": {
      "description": "Number of newly created users",
      "type": "integer"
    },
    "updatedRecords": {
      "description": "Number of updated users",
      "type": "integer"
    },
    "failedRecords": {
      "description": "Number of users failed to create/update",
      "type": "integer"
    },
    "failedUsers": {
      "description": "A list of users that were failed to create/update",
      "type": "array",
      "id": "failedUsers",
      "items": {
        "type": "object",
        "$ref": "failedUserdata.json"
      }
    },
    "totalRecords": {
      "description": "Number of total records processed by the user import",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "message",
    "totalRecords"
  ]
}