Skip to content

[WIP] Add a first draft of the API documentation - #2917

Open
Chrystinne wants to merge 1 commit into
devfrom
cf/api-docs
Open

Chrystinne wants to merge 1 commit into
devfrom
cf/api-docs

Conversation

@Chrystinne

Copy link
Copy Markdown
Contributor

The API endpoints under /api/ are currently undocumented. This adds a first draft of the documentation in docs/API.md, so we can review the content and decide where it should live.

What's covered

  • The six project endpoints under /api/v1/ (list, search, versions, detail, access status and SHA256SUMS.txt), with parameters, response fields and curl examples. The example responses come from the public API.
  • Authentication options (anonymous, Basic, session, personal access tokens and OAuth tokens) and which endpoints accept each one.
  • Rate limits, errors and the legacy /api/v1/project/published/... paths.
  • A short overview of the annotation endpoints, with a TODO for request and response examples.

The OAuth and OpenID Connect endpoints for partner applications are not covered here.

Where to document the API

This draft is a Markdown file in the repository, so it is versioned and reviewed together with the code. Other options:

  • Render the same file as a page on the site (e.g. /about/api/), so API users can find it without going to GitHub.
  • Generate an OpenAPI schema from the code (e.g. with drf-spectacular), with an interactive page. This keeps the docs in sync automatically, but adds a dependency.

Notes for reviewers

The draft documents the current behaviour, which differs from some of the view docstrings:

  • Authentication is optional on the list, search, versions, detail and access endpoints. The docstrings say it is required, but no permission classes are set, so DRF allows anonymous requests at the lower rate limit.
  • The list endpoint returns every published project in one response (currently over 700). The docstring says it is paginated, but no pagination class is set.
  • abstract is returned as HTML.
  • The list and detail endpoints use different field names for the same data (core_doi, version_doi and publish_date in the list; doi and publish_datetime in the detail).

Fixing the docstrings, and deciding whether the list should be paginated, could follow in a separate PR.

@Chrystinne Chrystinne changed the title Add a first draft of the API documentation [WIP] Add a first draft of the API documentation Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant