Configuration¶
Reached as client.config, a container exposing five sub-namespaces over Alma's
/conf endpoints.
client.config.code_tables is the one to reach for when another method wants a
code you do not have to hand:
table = await client.config.code_tables.get_code_table("POLineCancellationReasons")
valid = [r.code for r in table.row if r.enabled == "true"]
client.config¶
AlmaClientConfigNS
¶
Bases: BaseNamespace
Namespace for config/admin functionality, exposed at client.config.
A container only – it has no methods of its own. The work is done by its five sub-namespaces:
| Attribute | Class |
|---|---|
client.config.sets |
AlmaClientConfigSetsNS |
client.config.libraries |
AlmaClientConfigLibrariesNS |
client.config.letters |
AlmaClientConfigLettersNS |
client.config.jobs |
AlmaClientConfigJobsNS |
client.config.code_tables |
AlmaClientConfigCodeTablesNS |
client.config.sets¶
AlmaClientConfigSetsNS
¶
Bases: BaseNamespace
Namespace for set functionality, exposed at client.config.sets.
Alma sets come in two flavours: itemized sets hold an explicit list of member
IDs, while logical sets are saved queries evaluated when the set is used.
Only itemized sets can have their membership edited with
manage_members.
get_list
async
Alma: Retrieve a list of Sets
¶
List the sets defined in the institution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content_type
|
str | None
|
Restrict to sets over one kind of record, e.g. |
None
|
set_type
|
Literal['ITEMIZED', 'LOGICAL'] | None
|
|
None
|
q
|
str | None
|
Search query, in Alma's |
None
|
limit
|
int
|
Maximum number of sets to return in this page. |
10
|
offset
|
int
|
Index of the first set to return, for paging. |
0
|
set_origin
|
Literal['UI', 'UI_CZ']
|
|
'UI'
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A page of sets, with |
Any
|
result so the caller can page through it. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the query or content type is not valid. |
Examples:
get_set
async
Alma: Retrieve a Set
¶
get_set(set_id: str, *, model: None = ...) -> RESP_TYPE
Retrieve a single set by its ID.
Returns the set's metadata – name, type, content type, member count – but not
its members. Use
get_members for those.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
set_id
|
str
|
The numeric set identifier. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The set record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no set with that ID exists. |
Examples:
create
async
Alma: Create a Set
¶
create(
data: Body,
population: str | None = ...,
job_instance_id: str | None = ...,
from_logical_set: str | None = ...,
combine: str | None = ...,
set1: str | None = ...,
set2: str | None = ...,
nz_set_from_iz_set: str | None = ...,
indication_rule: str | None = ...,
*,
model: type[_ModelT],
) -> _ModelT
create(
data: Body,
population: str | None = ...,
job_instance_id: str | None = ...,
from_logical_set: str | None = ...,
combine: str | None = ...,
set1: str | None = ...,
set2: str | None = ...,
nz_set_from_iz_set: str | None = ...,
indication_rule: str | None = ...,
*,
model: None = ...,
) -> RESP_TYPE
Create a set.
Alma builds the new set in one of several ways depending on which optional
argument is supplied – from a job's results, by combining two existing sets,
by copying a logical set, and so on. Supply at most one of them; the plain
form with none creates an empty itemized set from data alone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Body
|
The set record to create – at minimum |
required |
population
|
str | None
|
Which subset of a job's output to build the set from, e.g.
|
None
|
job_instance_id
|
str | None
|
Build the set from the results of this job instance. |
None
|
from_logical_set
|
str | None
|
ID of a logical set to itemize into the new set. |
None
|
combine
|
str | None
|
Set operation to apply to |
None
|
set1
|
str | None
|
ID of the first operand set for |
None
|
set2
|
str | None
|
ID of the second operand set for |
None
|
nz_set_from_iz_set
|
str | None
|
ID of an institution-zone set to build the corresponding network-zone set from. |
None
|
indication_rule
|
str | None
|
ID of an indication rule to filter members by. |
None
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The newly created set record, including its assigned |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the body is incomplete, the referenced sets or job instance do not exist, or the combination of arguments is not valid. |
Examples:
get_members
async
Alma: Retrieve Set Members
¶
Retrieve a page of a set's members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
set_id
|
str
|
The numeric set identifier. |
required |
limit
|
int
|
Maximum number of members to return in this page. |
100
|
offset
|
int
|
Index of the first member to return, for paging. |
0
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A page of members, with |
Any
|
whole set. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no set with that ID exists. |
Examples:
Page through a set of any size:
delete_set
async
Alma: Delete a Set
¶
delete_set(set_id: str) -> None
Delete a set.
Deletes the set itself, not the records it contains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
set_id
|
str
|
The numeric set identifier. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no set with that ID exists, or it is in use by a scheduled job. |
Examples:
manage_members
async
Alma: Manage Members
¶
Add, remove or replace the members of an itemized set.
Alma requires the whole set record on this call, so this method fetches the set first and then posts it back with the member list attached – it costs two API requests, not one. Only itemized sets can be edited this way; logical sets derive their membership from a query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
set_id
|
str
|
The numeric set identifier. |
required |
member_id_list
|
list[str]
|
The record identifiers to act on. These must match the
set's content type – MMS IDs for a |
required |
id_type
|
str | None
|
The kind of identifier in |
None
|
op
|
Literal['add_members', 'delete_members', 'replace_members']
|
|
required |
fail_on_invalid
|
bool
|
When True, an unrecognised identifier fails the whole call. Set to False to have Alma skip bad IDs and apply the rest. |
True
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The updated set record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the set does not exist, is a logical set, or an
identifier is invalid and |
Examples:
client.config.libraries¶
AlmaClientConfigLibrariesNS
¶
Bases: BaseNamespace
Namespace for library functionality, exposed at client.config.libraries.
Reads the institution's physical structure: its libraries, the locations and circulation desks within each, and its work departments. Everything here is read-only – Alma does not expose library configuration for editing over the API.
get_libraries
async
Alma: Retrieve Libraries
¶
get_libraries(*, model: type[_ModelT]) -> _ModelT
List every library in the institution.
Unpaginated – Alma returns them all in one response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
All libraries, each with its |
Any
|
are what the other methods on this namespace expect. |
Examples:
get_circ_desks
async
Alma: Retrieve Circulation Desks
¶
get_circ_desks(
library: str, *, model: None = ...
) -> RESP_TYPE
List the circulation desks belonging to a library.
Circulation desk codes are needed when creating loans and scanning items in.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
library
|
str
|
The library code, as returned by
|
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The library's circulation desks. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no library with that code exists. |
Examples:
get_locations
async
Alma: Retrieve Locations
¶
get_locations(
library: str, *, model: None = ...
) -> RESP_TYPE
List the shelving locations within a library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
library
|
str
|
The library code, as returned by
|
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The library's locations, each with its |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no library with that code exists. |
Examples:
get_location
async
Alma: Retrieve Location
¶
Retrieve a single shelving location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
library
|
str
|
The library code the location belongs to. |
required |
location
|
str
|
The location code. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The location record, including its external name and fulfilment unit. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the library or location code does not exist. |
Examples:
get_departments
async
Alma: Retrieve Departments
¶
List the institution's work departments.
Departments are the work areas material passes through – acquisitions,
digitisation, binding – and their codes are what
receive_existing_item
and the request-processing endpoints expect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
department_type
|
Literal['DIGI', 'ALL']
|
|
'ALL'
|
view
|
Literal['brief', 'FULL']
|
|
'brief'
|
library
|
str | None
|
Restrict to departments serving this library code. |
None
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The matching departments. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the library code does not exist. |
Examples:
client.config.letters¶
AlmaClientConfigLettersNS
¶
Bases: BaseNamespace
Namespace for letter functionality, exposed at client.config.letters.
Letters are the XSL templates Alma renders notifications from – overdue notices,
hold shelf slips, and so on. Note that
update_letter takes
and returns XML rather than a mapping, since the template body is itself XSL.
get_letters
async
Alma: Retrieve Letters
¶
get_letters(*, model: type[_ModelT]) -> _ModelT
List the institution's letter templates.
Returns letters only. Use
get_components
for the shared header and footer fragments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
All letter templates, each with its |
Any
|
enabled state. |
Examples:
get_components
async
Alma: Retrieve Letters
¶
get_components(*, model: type[_ModelT]) -> _ModelT
List the shared letter components.
Components are the fragments – headers, footers, style blocks – that
individual letters include. Same endpoint as
get_letters,
filtered to type=COMPONENT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
All letter components. |
Examples:
get_letter
async
Alma: Retrieve Letter
¶
get_letter(
letter_id: str, *, model: None = ...
) -> RESP_TYPE
Retrieve a single letter template, including its XSL body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
letter_id
|
str
|
The letter code, e.g. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The letter record, with the template source in its |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no letter with that code exists. |
Examples:
update_letter
async
Alma: Update Letter
¶
Replace a letter template.
Unlike the rest of almapy this method sends XML: data is a string,
posted with Content-Type: application/xml, not a mapping. Fetch the
current letter with
get_letter first –
Alma replaces the whole record, so a partial body drops the rest of it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
letter_id
|
str
|
The letter code, e.g. |
required |
data
|
str
|
The complete letter record as an XML string. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The updated letter record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no letter with that code exists, or the XML is malformed or fails Alma's schema validation. |
Examples:
client.config.jobs¶
AlmaClientConfigJobsNS
¶
Bases: BaseNamespace
Namespace for job functionality, exposed at client.config.jobs.
Covers two related areas of Alma configuration:
- Jobs – the definitions Alma can run, the instances (individual runs) of
each, and the records a run matched. Submitting a job is asynchronous:
submit_jobreturns immediately with an instance link, and progress is read back withget_job_instance. - Integration profiles – the configuration for Alma's external system integrations, which are the only objects here that can be created and edited.
get_jobs
async
Alma: Retrieve Jobs
¶
List the jobs defined in the institution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
Maximum number of jobs to return in this page. |
10
|
offset
|
int
|
Index of the first job to return, for paging. |
0
|
category
|
str | None
|
Restrict to one job category, e.g. |
None
|
job_type
|
Literal['MANUAL', 'SCHEDULED', 'OTHER'] | None
|
|
None
|
profile_id
|
str | None
|
Restrict to jobs belonging to this integration or import profile. |
None
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A page of jobs, with |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the category or profile ID is not valid. |
Examples:
get_job
async
Alma: Retrieve Job Details
¶
get_job(job_id: str, *, model: None = ...) -> RESP_TYPE
Retrieve a single job definition.
The response lists the job's parameters, which is how you discover what
submit_job expects in
its body for this particular job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier, e.g. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The job definition, including its parameter list. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no job with that ID exists. |
Examples:
submit_job
async
Alma: Submit a manual or scheduled job
¶
submit_job(
job_id: str, job: Body, *, model: None = ...
) -> RESP_TYPE
Submit a job for execution.
This is asynchronous: Alma queues the job and returns immediately with a link
to the new instance. Poll
get_job_instance
to follow its progress.
Being a POST, this call is not replayed if the response is lost in transit – a retry could queue the job twice. See the retry semantics in Rate limiting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier to run. |
required |
job
|
Body
|
The job's parameters, normally a |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A record containing |
Any
|
newly created job instance. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the job does not exist, a required parameter is missing, or the job cannot be run manually. |
Examples:
get_job_instances
async
Alma: Retrieve Job Instances
¶
List the runs (instances) of a job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier. |
required |
limit
|
int
|
Maximum number of instances to return in this page. |
10
|
offset
|
int
|
Index of the first instance to return, for paging. |
0
|
submit_date_from
|
str | None
|
Earliest submission date to include, as |
None
|
submit_date_to
|
str | None
|
Latest submission date to include, as |
None
|
status
|
str | None
|
Restrict to one run status, e.g. |
None
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A page of job instances, most recent first. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the job does not exist or a date is malformed. |
Examples:
get_job_instance
async
Alma: Retrieve Job Instance Details
¶
Retrieve a single job run, including its status and counters.
This is what you poll after
submit_job: the
status field reports progress, and counter carries the per-stage
record counts once the run finishes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier. |
required |
instance_id
|
str
|
The identifier of the individual run. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The job instance record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the job or instance does not exist. |
Examples:
get_job_instance_matches
async
Alma: Retrieve Job Matching Details
¶
Retrieve the records a job run matched.
Applies to import and matching jobs, which classify each incoming record by how many existing records it matched.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier. |
required |
instance_id
|
str
|
The identifier of the individual run. |
required |
single_or_multi
|
Literal['single', 'multi']
|
|
required |
limit
|
int
|
Maximum number of matches to return in this page. |
10
|
offset
|
int
|
Index of the first match to return, for paging. |
0
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A page of matched records. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the job or instance does not exist, or the job is not one that produces match results. |
Examples:
get_integration_profiles
async
Alma: Retrieve a list of Integration Profiles
¶
List the institution's integration profiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_type
|
str | None
|
Restrict to one profile type, e.g. |
None
|
query
|
str | None
|
Search query, in Alma's |
None
|
limit
|
int
|
Maximum number of profiles to return in this page. |
10
|
offset
|
int
|
Index of the first profile to return, for paging. |
0
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A page of integration profiles. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the profile type or query is not valid. |
Examples:
get_integration_profile
async
Alma: Retrieve an Integration Profile
¶
get_integration_profile(
profile_id: str, *, model: None = ...
) -> RESP_TYPE
Retrieve a single integration profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_id
|
str
|
The profile identifier. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The integration profile record, including its type-specific settings. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no profile with that ID exists. |
Examples:
update_integration_profile
async
Alma: Update an Integration Profile
¶
update_integration_profile(
profile_id: str, data: Body, *, model: None = ...
) -> RESP_TYPE
Replace an integration profile.
Alma replaces the whole profile, so fetch it with
get_integration_profile
and modify that rather than sending a partial body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_id
|
str
|
The profile identifier. |
required |
data
|
Body
|
The full, modified profile record. Accepts a mapping or any object
implementing |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The updated integration profile record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no profile with that ID exists, or the body fails Alma's validation for the profile type. |
Examples:
create_integration_profile
async
Alma: Retrieve an Integration Profile
¶
create_integration_profile(
data: Body, *, model: type[_ModelT]
) -> _ModelT
Create an integration profile.
Being a POST, this call is not replayed if the response is lost in transit – a retry could create a second profile. See Rate limiting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Body
|
The profile record to create. The required fields depend on the
profile |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The newly created profile record, including its assigned ID. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the body is incomplete or fails Alma's validation for the profile type. |
Examples:
client.config.code_tables¶
AlmaClientConfigCodeTablesNS
¶
Bases: BaseNamespace
Namespace for code table functionality, exposed at client.config.code_tables.
Worth reaching for when another method wants a code you do not have to hand: institutions add and disable rows freely, so the live table is the only dependable list.
get_code_tables
async
Alma: Retrieve Code Tables
¶
get_code_tables(*, model: type[_ModelT]) -> _ModelT
List the names of every code table in the institution.
Returns table names only, not their rows – use
get_code_table
for the contents of one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
All code table names. |
Examples:
get_code_table
async
Alma: Retrieve Code-table
¶
Retrieve a code table and its rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_code
|
str
|
The table name, e.g. |
required |
lang
|
str
|
Two-letter language code for the row descriptions. |
'en'
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The code table, whose |
Any
|
|
Any
|
returned, and Alma rejects them if used. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no table with that name exists. |
Examples:
Discover the cancellation reasons this institution accepts:
update_code_table
async
Alma: Update Code-table
¶
Replace a code table's rows.
Alma replaces the entire table, so fetch it with
get_code_table
and modify that – sending only the rows you care about deletes every other
row in the table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_code
|
str
|
The table name. |
required |
data
|
Body
|
The full, modified code table record. Accepts a mapping or any
object implementing |
required |
lang
|
str
|
Two-letter language code the descriptions in |
'en'
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The updated code table. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If no table with that name exists, the table is not editable, or a row is malformed. |
Examples: