The Patron API - Patron Record
The Patron API contains methods for creating, retrieving, updating, deleting, and validating patron records. Using these endpoints, you can:
- Create a patron record
- Get a list of patrons
- Get a patron by record ID
- Get a list of patron metadata
- Find a patron by varField fieldTag and varField content
- Filter the records by a query in JSON format
- Update a patron record
- Delete a patron record
- Validate a patron by barcode and PIN
The Try it out! links below take you to the corresponding section in the interactive documentation, where you can view the model, model schema, and parameters for each available operation.
Create a Patron Record
POST /v6/patrons/
Requires a PatronPatch request object.
You can create a patron with these fields:
- name
- address
- phone number
- email address
- PIN
- patron type
- barcodes
- expiration date
- birth date
- patron codes – pcode1, pcode2, pcode3, and pcode4
- block information – manual block code
- unique ids – patron unique ID
- pMessage – library-defined patron message
- home library code – patron's home library
- language preference – if installed, specifies the language preferences for patron notices
- fixedFields – fixed-length fields from the patron record. One or more fixed fields are supported with each patron record creation.
{
fixedFields":
{
"44":{"label":"Patron Code 1","value":"c"},
"46":{"label":"Patron Code 3","value":"4"},
"47":{"label":"Patron Type","value":"5"},
}
}
- varFields – Array used to create note, message, and patron image (PAT IMAGE) fields
If created successfully, HTTP 200 and a link to the patron’s ID are returned.
Get a List of Patrons
GET /v6/patrons/
Returns the properties of the first x patron objects, where x = the default record limit.
Records can be filtered by:
List of agency codes | Returns patron data for a comma delimited list of one or more agency codes that you supply. If no data exists for the agency code you have entered, the error “Record not found” is returned |
One or a range of assessed dates | Returns patron data for one or a range of dates. The filtering is done on the date that the fine was assessed. Data entry format The format of the date range is [YYYY-MM-DD,YYYY-MM-DD]. The format of a single date is YYYY-MM-DD. The error: “Invalid parameter” is returned if an incorrect data format is used. If no data exists, the error: “No record found” is returned. The “Total” parameter returned as part of the result set contains the total number of records in the database; and not the total number of filtered records returned. |
Get a patron by record ID
GET /v6/patrons/{id}
Returns a single patron object with the specified record ID.
Get a List of Patron Metadata
GET /v6/patrons/metadata
Returns patron metadata for the supplied field parameter, where allowable parameters are “patronType”, “pcode1”, “pcode2”, “pcode3”, “pcode4”, “mBlock”, “pMessage”, “langPref” and “homeLibrarycode”. When no parameters are supplied, patron metadata is returned for all allowable parameters. If a language parameter is supplied and that language is configured in Sierra, data returned is in the supplied language; otherwise, data is returned in English.
Returns a MetadataValue object.
Find a Patron by varField fieldTag and varField Content
GET /v6/patrons/find
Returns a patron object for the supplied varFieldTag and varFieldValue. The varFieldTag is a single character that is used to locate the varFieldValue of that type. For example, if you have configured ‘u’ to be uniqueId on your Sierra system, then entering varFieldTag = ‘u’ and varFieldValue = ‘12345’ returns the associated patron object for uniqueId ‘12345’. Supports case sensitivity.
Filter the Records by a Query in JSON Format
POST /v6/patrons/query
Returns a list of records that satisfy the JSON query.
See Creating a JSON Query for information about the structure of Sierra JSON queries.
Update a Patron Record
PUT /v6/patrons/{id}
Updates a specified patron record. Requires a PatronPatch request object.
If updated successfully, HTTP 204 is returned.
Delete a Patron Record
DELETE /v6/patrons/{id}
Deletes the patron record for the specified id.
If the patron has been deleted successfully, an HTTP 204 is returned. If there are fines due or books currently checked out against that patron ID, the patron record is not deleted and an HTTP 409 is returned.
Validate a patron by barcode and PIN
POST /v6/patrons/validate
Validates a patron using the fields configured for your library's Sierra system (frequently, the barcode or unique ID and PIN). If validation is successful, an HTTP 204 status is returned. Otherwise, an error code is returned. This requires a PatronValidation request object.
The following example shows the JSON structure used for validation:
{
"barcode": "abc2129401127"
"pin": "socomplex"
}
By default, the barcode is case sensitive. If your library uses the uniqueId field identifier for patron validation instead of the barcode or your library has barcodes that contain spaces (including trailing spaces), use the the caseSensitivity parameter to allow for case-insensitive validation. The following example shows the JSON structure used for validation with caseSensitivity set to false:
{
"barcode": "abc2129401127"
"pin": "socomplex"
"caseSensitivity": false
}
Note: When both the barcode and uniqueId are used, a library can use the barcode field as the patron's barcode or unique ID.