Purpose:
This page will provide the API contracts for LC user registration.
POST:
Description: Create patron.
API: https://folio-dev-volaris-edge.ci.folio.org/patron/account/{externalSystemID}?apikey=eyJzIjoieHFpNzNjNEZzOSIsInQiOiJkaWt1IiwidSI6ImRpa3VfYWRtaW4ifQ==
NOTE:- we can provide any existing id of a patron OR externalSystemID of an existing user.(will be used internally to perform operation on behalf of the user)
PAYLOAD:
{ "generalInfo": { "externalSystemId": "ext-kapil-new-record-100", "firstName": "new-record-100", "preferredFirstName": "New Record", "middleName": "", "lastName": "new-record-100" }, "addressInfo": { "addressLine0": "123 Main St", "addressLine1": "Apt 4B", "city": "Metropolis", "province": "NY", "zip": "12345", "country": "USA" }, "contactInfo": { "phone": "555-123456", "mobilePhone": "555-5678", "email": "new-record-100@test.com" }, "preferredEmailCommunication": ["Support", "Programs", "Services"] }
RESPONSE:
-A user will be created with userType “patron” and patron_group “Remote Non-circulating“ ,
-addressInfo
is stored in Folio as Home
-
{ "generalInfo": { "externalSystemId": "ext-kapil-new-record-100", "firstName": "new-record-100", "preferredFirstName": "New Record", "middleName": "", "lastName": "new-record-100" }, "addressInfo": { "addressLine0": "123 Main St", "addressLine1": "Apt 4B", "city": "Metropolis", "province": "NY", "zip": "12345", "country": "USA" }, "contactInfo": { "phone": "555-123456", "mobilePhone": "555-5678", "email": "new-record-100@test.com" }, "preferredEmailCommunication": [ "Support", "Programs", "Services" ] }
PUT:
Description: Update patron by email.
API: https://folio-dev-volaris-edge.ci.folio.org/patron/account/{externalSystemID}/by-email/ext-kapil-2@test.com?apikey=eyJzIjoieHFpNzNjNEZzOSIsInQiOiJkaWt1IiwidSI6ImRpa3VfYWRtaW4ifQ==
PAYLOAD:
{ "generalInfo": { "externalSystemId": "ext-kapil-2", "firstName": "Kapil2", "preferredFirstName": "Inactive or Expired and Remote Non-circulation", "middleName": "", "lastName": "Sony" }, "addressInfo": { "addressLine0": "123 Main St", "addressLine1": "Apt 4B", "city": "Metropolis", "province": "NY", "zip": "12345", "country": "USA" }, "contactInfo": { "phone": "555-123456", "mobilePhone": "555-5678", "email": "ext-kapil-2@test.com" }, "preferredEmailCommunication": ["Support", "Programs"] }
RESPONSE:
A user will be updated with provided payload with API response 204
GET:
Description: Get patron by email.
API: https://folio-dev-volaris-edge.ci.folio.org/patron/account/{externalSystemID}/by-email/ext-kapil-2@test.com?apikey=eyJzIjoieHFpNzNjNEZzOSIsInQiOiJkaWt1IiwidSI6ImRpa3VfYWRtaW4ifQ==
PAYLOAD: none
RESPONSE:
A user will be returned in the form of external_patron .
{ "generalInfo": { "externalSystemId": "ext-kapil-new-record-100", "firstName": "new-record-100", "preferredFirstName": "New Record", "middleName": "", "lastName": "new-record-100" }, "addressInfo": { "addressLine0": "123 Main St", "addressLine1": "Apt 4B", "city": "Metropolis", "province": "NY", "zip": "12345", "country": "USA" }, "contactInfo": { "phone": "555-123456", "mobilePhone": "555-5678", "email": "new-record-100@test.com" }, "preferredEmailCommunication": [ "Support", "Programs", "Services" ] }
GET:
Description: Get expired LC patrons.
API: https://folio-dev-volaris-edge.ci.folio.org/patron/account/{externalSystemID}/external-patrons?apikey=eyJzIjoieHFpNzNjNEZzOSIsInQiOiJkaWt1IiwidSI6ImRpa3VfYWRtaW4ifQ==&expired=true
PAYLOAD: none
Note : This API will fetch expired users for previous day only (business day -1).
RESPONSE:
A collection of LC users will be returned in the form of external_patron_collection .
{ "externalPatrons": [ { "generalInfo": { "externalSystemId": "ext-kapil-2", "firstName": "Kapil2", "preferredFirstName": "Inactive or Expired and Remote Non-circulation", "lastName": "Kapil2" }, "addressInfo": { "addressLine0": "123 Main St", "addressLine1": "Apt 4B", "city": "Metropolis", "country": "" }, "contactInfo": { "phone": "555-123456", "mobilePhone": "555-5678", "email": "ext-kapil-2@test.com" }, "preferredEmailCommunication": [ "Programs", "Support" ] } ], "totalRecords": 1 }
Error Code Responses
ERROR CODE for ALL the API’s (negative scenarios) - Work in progress (will be updated by end of SPRINT 197)
Sample Error Responses:
API TYPE | ERROR | |
---|---|---|
POST | 422: User account is not active | { "code": 422, "errorMessage": "User account is not active", "errorCode": "USER_ACCOUNT_INACTIVE" } |
422: User does not belong to the required patron group | { "code": 422, "errorMessage": "User does not belong to the required patron group", "errorCode": "INVALID_PATRON_GROUP" } | |
422: User already exists | { "code": 422, "errorMessage": "User already exists", "errorCode": "USER_ALREADY_EXIST" } | |
PUT | 404: user does not exist | { "code": 404, "errorMessage": "User does not exist", "errorCode": "USER_NOT_FOUND" } |
400: User already exist with email provided in payload | { "code": 400, "errorMessage": "User already exist with email provided in payload", "errorCode": "EMAIL_ALREADY_EXIST" } |