Records
The record summary route (GET /{orcid}/record) returns everything
public in one document: the ORCID identifier, preferences, history, the
person section, and the activities summary. client.records.get()
validates it into OrcidRecord. The snippets of this page run top to
bottom with top-level await, and the first block creates the client
every later block reuses.
Get a record
Every iD spelling works: the https://orcid.org/ URL, the compact
16-digit form, and the bare hyphenated iD all normalize to the same
record.
from bibliofabric.orcid import OrcidClient
client = OrcidClient()
for value in (
"https://orcid.org/0000-0002-1694-233X",
"000000021694233X",
"0000-0002-1694-233X",
):
record = await client.records.get(value)
print(record.orcid_identifier.path, "accepted:", value)
print("claimed:", record.history.claimed)
0000-0002-1694-233X accepted: https://orcid.org/0000-0002-1694-233X
0000-0002-1694-233X accepted: 000000021694233X
0000-0002-1694-233X accepted: 0000-0002-1694-233X
claimed: True
exists(orcid) sends GET and returns False on 404.
Read the sections
record.person holds the full person section and
record.activities_summary holds every activity section as it stood with
the record. A section the record does not use is None. For fresh data,
fetch the sections through client.person and client.activities,
which hit their own routes; see Person and
Activities.
ORCID wraps almost every scalar as {"value": ...}. The models expose
wrapped text through the text property, so given_names.text answers
the string, and a missing field answers None. Dates validate into
FuzzyDate from bibliofabric.orcid.models, whose iso() returns
2020, 2020-06, or 2020-06-15 depending on the parts the record
carries; a date with a year and a day but no month answers the year
alone.
name = record.person.name
print(name.given_names.text, name.family_name.text)
print("credit name:", name.credit_name.text if name.credit_name else None)
Thomas B. Hickey
credit name: None
Get the XML representation
representation(orcid) requests the same route with
Accept: application/xml and returns the body as text. The API also
answers XML when a request carries no Accept header at all.
xml = await client.records.representation("0000-0002-1694-233X")
print(xml[:120].replace("\n", " "))
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <record:record path="/0000-0002-1694-233X" xmlns:internal="http:
application/ld+json answers 406 on the public API, so no JSON-LD method exists.