FMR clients
Important
These clients are still EXPERIMENTAL and their API is subject to change without warnings.
FMR Transactions client
Use this client to browse and retrieve transactions in an FMR. Each transaction records a change to structural or reference metadata. The target FMR instance must be version 12.5.0 or later.
>>> from datetime import UTC, datetime
>>> from pysdmx.api.fmr.maintenance import RegistryTransactionsClient
>>> client = RegistryTransactionsClient("https://your-fmr.org")
>>> txs = client.list_transactions(datetime(2026, 10, 1, 0, 0, 0, 0, UTC))
>>> print(f"{len(txs)} transactions")
>>> tx = txs[0]
>>> print(f"Transaction ID: {tx.meta.transaction_id}")
>>> transaction = client.get_transaction(tx.meta.transaction_id)
>>> print(transaction)
- class pysdmx.api.fmr.maintenance.RegistryTransactionsClient(api_endpoint, pem=None, timeout=60.0)
EXPERIMENTAL: Client for accessing FMR registry transactions.
- Args:
api_endpoint: The endpoint of the target FMR service. pem: A PEM file for an otherwise untrusted certificate authority. timeout: Seconds to wait for a request. Defaults to 60.
Warning: This class is experimental and subject to change without prior notice. It is not covered by semantic versioning guarantees, and modifications to this class will not result in a major version increment. Use it with caution in production environments or critical processes.
- get_transaction(transaction_id)
Retrieve the content of a registry transaction.
- Parameters:
transaction_id (
str) – The identifier of the transaction to retrieve.- Return type:
Union[StructureMessage,MetadataMessage]- Returns:
The SDMX structure or reference metadata message contained in the transaction.
- Raises:
InternalError – If the transaction content cannot be read as an SDMX structure or reference metadata message.
- list_transactions(updated_after=None)
List transactions that occurred after an optional point in time.
- Parameters:
updated_after (
Optional[datetime]) – Return only transactions updated after this time. If not provided, return all transactions. A timezone-naive datetime is interpreted as UTC.- Return type:
Sequence[RegistryTx]- Returns:
The transactions returned by the FMR.
FMR Maintenance client
This is the client to be used for maintaining metadata in an SDMX Registry. This client inherits from RegistryTransactionsClient and can therefore also be used to browse and retrieve transactions.
>>> from pysdmx.api.fmr.maintenance import RegistryMaintenanceClient
>>> cd = Code("A", name="Code A")
>>> cl = Codelist("CL_TEST", agency="TEST", name="Test CL", items=[cd])
>>> target = "https://registry.sdmx.org"
>>> client = RegistryMaintenanceClient(target, "user", "password")
>>> client.put_structures([cl])
- class pysdmx.api.fmr.maintenance.RegistryMaintenanceClient(api_endpoint, user=None, password=None, access_token=None, pem=None, timeout=60.0)
EXPERIMENTAL: A client to update metadata in the FMR.
The client supports two authentication modes:
Bearer token authentication via
access_tokenHTTP Basic authentication via
userandpassword
If
access_tokenis provided, it takes precedence overuserandpassword.The client does not obtain or refresh OIDC/OAuth2 tokens itself. It is the responsibility of the caller to acquire a valid access token from their authentication provider and pass it to this client.
- put_metadata_reports(reports, header=None, action=StructureAction.Replace)
EXPERIMENTAL: Upload SDMX metadata reports to the FMR.
This method is experimental and its interface or behavior may change without notice.
- Parameters:
reports (
Sequence[MetadataReport]) – A sequence of metadata reports to upload.header (
Optional[Header]) – Optional SDMX Header to include in the message. If not supplied, pysdmx will generate one for you.action (
StructureAction) – How to apply the changes in case of already existing structures.
- Return type:
None
- put_structures(artefacts, header=None, action=StructureAction.Replace)
EXPERIMENTAL: Upload SDMX structures to the FMR.
This method is experimental and its interface or behavior may change without notice.
- Parameters:
artefacts (
Sequence[MaintainableArtefact]) – The sequence of SDMX maintainable artefacts to upload. Availability constraints are not maintainable artefacts and are skipped with a warning if present (e.g. when passing thestructuresof a message returned by an availability query).header (
Optional[Header]) – Optional SDMX Header to include in the message. If not supplied, pysdmx will generate one for you.action (
StructureAction) – How to apply the changes in case of already existing structures.
- Warns:
UserWarning – If
artefactscontains availability constraints. They are not maintainable artefacts and, therefore, they are not meant to be stored in the FMR, so they are skipped.- Return type:
None