Identifiers.org
The Identifiers.org client (bibliofabric.identifiersdotorg) reads the two
public APIs of Identifiers.org:
the resolution service at resolver.api.identifiers.org and the registry
service at registry.api.identifiers.org. It resolves compact identifiers,
converts provider URLs back into identifiers.org URIs, and reads the
namespace registry. An async client and a generated sync twin expose the
same calls.
Credentials
The APIs need no credentials. The client paces itself to one request per
second by default, because upstream documents no numeric rate limit; tune it
with IDENTIFIERSDOTORG_MAX_REQUESTS_PER_SECOND and
IDENTIFIERSDOTORG_MAX_CONCURRENCY, as the
settings guide describes.
License
Identifiers.org data, including the resolver dataset this client downloads, falls under the Creative Commons Attribution 4.0 license. The terms of use govern the services themselves.
Quick start
from bibliofabric.identifiersdotorg import IdentifiersDotOrgClient
async with IdentifiersDotOrgClient() as client:
resolved = await client.resolve("taxonomy:9606")
print(len(resolved), "resources; best:", resolved[0].description)
print(resolved[0].compact_identifier_resolved_url)
6 resources; best: European Nucleotide Archive (ENA)
https://www.ebi.ac.uk/ena/data/view/Taxon:9606
resolve() lists one entry per provider of the namespace, sorted by the
upstream recommendation index, best first. A curie the registry cannot
resolve (unknown prefix, or a local identifier that misses the namespace
pattern) raises NotFoundError carrying the upstream explanation. A curie
with a provider code, such as pdbe/pdb:2gc4, resolves the same way.
The sync twin IdentifiersDotOrgSyncClient runs the same calls without
await; see async and sync clients.
Reverse resolution
match = await client.reverse("https://www.ebi.ac.uk/intact/interaction/EBI-2307691")
print(match.possible_idorg_curie, match.lui_pattern_match)
intact:EBI-2307691 True
reverse() answers None when no namespace claims the URL;
similar() answers a ranked list of near matches instead.
The registry
Four resources read the registry: client.namespaces, client.resources
(the provider sites), client.institutions, and client.locations. The
key most users have is the prefix:
namespace = await client.namespaces.by_prefix("chebi")
print(namespace.mir_id, namespace.pattern)
MIR:00000002 ^CHEBI:\d+$
search(), iterate(), collect(), and count() walk the browse routes.
get() reads one record by its numeric registry id (the country code for
locations). The by_ methods read the search routes and return full lists:
by_prefix_start(), by_prefix_containing(), by_provider_code(),
by_namespace(), by_name(), by_name_fragment(), and
by_country_code().
What the client offers
| Attribute or method | Reads |
|---|---|
resolve(curie) |
GET /{curie} on the resolver, one ResolvedResource per provider |
reverse(url) |
POST /reverse/byPrefix, one exact match or None |
similar(url) |
POST /reverse/bySimilarity, a ranked match list |
namespaces |
namespace browse, prefix searches, and single records |
resources |
provider browse, provider code and namespace searches |
institutions |
institution browse, name and country searches |
locations |
country browse and single records |
namespace_usage(prefix) |
GET /statistics/namespace/{prefix} |
download_resolver_dataset(dest) |
GET /resolutionApi/getResolverDataset, the full registry snapshot |
batch_get raises ConfigurationError on every registry resource because
no route reads several records by id; call get() per id. The snapshot is
about 2 MB of JSON; iter_resolver_dataset() reads a downloaded file into
typed Namespace records with their nested resources.
Examples
Runnable scripts live in packages/bibliofabric/examples/identifiersdotorg:
quickstart.py: resolve a curie, reverse a provider URL, and read the registry.sync_quickstart.py: the same calls without an event loop.
Pages
- Upstream quirks: HAL paging shapes, sort spelling, and error bodies.
- API reference: every public class, generated from the source.
Next
- The registry browse UI at registry.identifiers.org.
- The SPARQL endpoint at docs.identifiers.org/pages/sparql.html, which the client does not cover.