Datatracker API Notes
Framework API
This section describes the autogenerated read-only API towards the database tables. See also the Internet-Draft submission API description.
The datatracker API uses tastypie to generate an API which mirrors the Django ORM (Object Relational Mapping) for the database. Each Django model class maps down to the SQL database tables and up to the API. The Django models classes are defined in the models.py files of the datatracker. Browse the code tree for the models file in each app (such as ietf/doc/models.py, ietf/group/models.py, …).
The API top endpoint is at
https://datatracker.ietf.org/api/v1.
The top
endpoint lists inferior endpoints, and thus permits some autodiscovery,
but there's really no substitute for looking at the actual ORM model classes.
Comparing a class in models.py with the equivalent endpoint may give
some clue (note that in the case of Group, it's a subclass of GroupInfo):
Data is currently provided in JSON and XML format. Adding new formats is fairly easy, if it should be found desirable.
Framework API: Documents
Documents are listed at /api/v1/doc/document/.
In general, individual database objects are represented in the API with a path
composed of the model collection, the object name, and the object key. Most
objects have simple numerical keys, but documents have the document name as
key. Take draft-ietf-eppext-keyrelay. Documents have a model Document which
is described in the doc models.py file. Assembling the path components
doc, document (lowercase!) and draft-ietf-eppext-keyrelay, we get the
URL:
https://datatracker.ietf.org/api/v1/doc/document/draft-ietf-eppext-keyrelay/
If you instead do a search for this document, you will get a machine-readable search result, which is composed of some meta-information about the search, and a list with one element:
api/v1/doc/document/?name=draft-ietf-eppext-keyrelay
To search for documents based on state, you need to know that documents have multiple orthogonal states:
-
If a document has an rfc-editor state, you can select for it by asking for, e.g.,
v6ops documents which match
states__type__slug__in=draft-rfceditor -
If a document has an IESG state, you can select for it by asking for, e.g.,
v6ops documents which match
states__type__slug__in=draft-iesg -
If a document has a WG state, you can select for it by asking for
documents which match
states__type__slug__in=draft-stream-ietf(but without additional filters, that's going to be a lot of documents) -
States which match
states__type__slug__in=draftdescribe the basic Active/Expired/Dead whatever state of the Internet-Draft.
You could use this in at least two alternative ways:
-
You could either fetch and remember the different state groups of interest to you
with queries like
$ curl 'https://datatracker.ietf.org/api/v1/doc/state/?format=json&limit=0&type__slug__in=draft-rfceditor' $ curl 'https://datatracker.ietf.org/api/v1/doc/state/?format=json&limit=0&type__slug__in=draft-iesg' $ curl 'https://datatracker.ietf.org/api/v1/doc/state/?format=json&limit=0&type__slug__in=draft-stream-ietf'and then match the listed "resource_uri" of the results to the states listed for each document when you ask for$ curl 'https://datatracker.ietf.org/api/v1/doc/document/?limit=0&name__contains=-v6ops-' -
Or alternatively you could do a series of queries asking for matches to the RFC Editor
state first, then the IESG state, then the Stream state, and exclude earlier hits:
$ curl 'https://datatracker.ietf.org/api/v1/doc/document/?limit=0&name__contains=-v6ops-&states__type__slug__in=draft-rfceditor' ... $ curl 'https://datatracker.ietf.org/api/v1/doc/document/?limit=0&name__contains=-v6ops-&states__type__slug__in=draft-iesg' ...etc.
Simplified Documents API
A simplified Documents API, intended for cases where only a limited set of
document attributes are necessary for an application is
available for all documents at the relative url doc.json, e.g.,
/doc/draft-ietf-poised95-std-proc-3/doc.json.
You can also specify an RFC: /doc/rfc2026/doc.json.
No API key is needed to access this.
The simplified document API takes no parameters, and is invoked with a HTTP GET.
OpenID Connect
The datatracker supports
OpenID Connect,
but
not dynamic registration. The OpenID Connect Issuer is
https://datatracker.ietf.org/api/openid/
Datatracker Version
The datatracker version and release/patch date is available as a JSON blob at
/api/version
.