Skip to content

Add read-only API endpoints for public projects and expeditions - #568

Merged
rbruhn merged 4 commits into
developmentfrom
projects-expeditions-api
Oct 15, 2026
Merged

rbruhn merged 4 commits into
developmentfrom
projects-expeditions-api

Conversation

@rbruhn

@rbruhn rbruhn commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Adds read-only API endpoints for the public projects and expeditions, and documents them on the API page. Closes #82.

Endpoints

Endpoint Returns
GET /v1/projects Paginated public projects
GET /v1/projects/{uuid} One project
GET /v1/expeditions Paginated public expeditions
GET /v1/expeditions/{uuid} One expedition
  • Public means the same as on the site: projects with a Zooniverse project, and expeditions with a Zooniverse project and the Zooniverse actor (the existing publicProjectIndexQuery() / publicIndexQuery() in the services, without the page cache). Anything else returns 404.
  • Query: per_page (1–100, default 25) and page on lists; project_uuid and status (active / completed) on expeditions. Responses are standard Laravel resource pagination (data, links, meta).
  • Fields: projects omit the contact name and email. An expedition's links.participate is its Zooniverse classify URL only while it's processing there, as on the public card.
  • Uses the previously unused ExpeditionResource / ExpeditionCollection, plus new ProjectResource / ProjectCollection. PanoptesProjectPresenter gets a participateUrl() that returns the plain URL.

Token ability

  • New public:read ability, required by the new routes and added to the v1 group's list.
  • The WeDigBio dashboard route now checks its own four abilities explicitly, so existing tokens behave as before and a public:read-only token gets 403 there.
  • Nothing issues tokens yet; create them by hand, e.g. $user->createToken('name', ['public:read']).

API page

front/api-index now covers authentication, the rate limit, the endpoints, query parameters and an example response. The Apiary and GitHub buttons are unchanged.

Tested locally

  • tests/Feature/Api: 17 passed (new ProjectControllerTest, ExpeditionControllerTest, and a dashboard 403 case in ApiAccessTest).
  • tests/Feature/Api, tests/Feature/Front, presenter tests: 297 passed.
  • The API index page renders (200).

To verify on development

See #567.

rbruhn added 4 commits October 7, 2026 08:42
Merge development into production
Merge development into production [minor]
Merge development into production [minor]
GET /v1/projects and /v1/expeditions (list and show) return the projects
and expeditions shown on the public site, for tokens with the new
public:read ability. Lists are paginated (per_page up to 100); expeditions
filter by project_uuid and status. The WeDigBio dashboard keeps its own
ability list, so a public:read token cannot read it. The API page now
documents the new endpoints.

Closes #82
@rbruhn
rbruhn merged commit 245dcca into development Oct 15, 2026
2 checks passed
@rbruhn
rbruhn deleted the projects-expeditions-api branch October 15, 2026 16:42
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