Page MenuHomePhabricator

πŸ“œ Create endpoint to get polices that should be accepted
Closed, ResolvedPublic

Description

Stalled on T428175: πŸ“œ P1: Create database schema and models for policies and policy acceptances

Create a Resource/Resource Collection and a Controller to return the current list of polices that must be signed.

Polices that must be accepted are the most recent instance of a given type that have an active_from date in the past.

Add an endpoint @ GET /v1/policies/current. This endpoint requires no authentication.

with example JSON response:

{ 
  "items": [
    {
      "metadata": {
        "policy_id": 2
        "type": "hosting-policy",
        "active_from": "2025-12-25",
        "content_vue_file": "hosting-policy/version-1.vue"
      }
    },
    {
      "metadata": {
        "policy_id": 3
        "type": "terms-of-use",
        "active_from": "2024-11-07",
        "content_vue_file": "terms-of-use/version-2.vue"
      }
    },
    ...
  ]
}

PRs

Event Timeline

Tarrow renamed this task from `create GET /v1/policies/current endpoint` to πŸ“œ `create GET /v1/policies/current endpoint`.Jun 19 2026, 9:05 AM
Ollie.Shotton_WMDE renamed this task from πŸ“œ `create GET /v1/policies/current endpoint` to πŸ“œ [Platform API] Create `GET /v1/policies/current` endpoint.Jun 19 2026, 9:44 AM
Tarrow renamed this task from πŸ“œ [Platform API] Create `GET /v1/policies/current` endpoint to πŸ“œ [Platform API] Create endpoint to get polices that should be signed.Jun 24 2026, 12:38 PM
Tarrow renamed this task from πŸ“œ [Platform API] Create endpoint to get polices that should be signed to πŸ“œ [Platform API] Create endpoint to get polices that should be accepted.
Tarrow updated the task description. (Show Details)
Tarrow updated the task description. (Show Details)
Tarrow changed the task status from Open to Stalled.Jun 24 2026, 12:56 PM
Tarrow updated the task description. (Show Details)
Tarrow renamed this task from πŸ“œ [Platform API] Create endpoint to get polices that should be accepted to πŸ“œ Create endpoint to get polices that should be accepted.Jun 29 2026, 1:36 PM
Tarrow added a project: WbStack API.
Ollie.Shotton_WMDE renamed this task from πŸ“œ Create endpoint to get polices that should be accepted to πŸ“œ [Platform API] Create endpoint to get polices that should be accepted.Jun 29 2026, 9:55 PM
Ollie.Shotton_WMDE updated the task description. (Show Details)
dang removed dang as the assignee of this task.Jul 14 2026, 12:19 PM
dang subscribed.
dang removed dang as the assignee of this task.Jul 14 2026, 4:25 PM
dang moved this task from In Peer Review to Todo on the Wikibase Cloud (Kanban Board) board.

Flagging it here that it's debatable if returning this as an items object is the right choice here, as per default it seems to get wrapped in a generic data object anyway and I couldn't find any previous use of items notation in this API.
See https://github.com/wbstack/api/pull/1198/changes#r3572344840

tl;dr how do people feel about data instead of items?

{ 
  "data": [
    {
      "metadata": {
        "policy_id": 2
        "type": "hosting-policy",
        "active_from": "2025-12-25",
        "content_vue_file": "hosting-policy/version-1.vue"
      }
    },
    {
      "metadata": {
        "policy_id": 3
        "type": "terms-of-use",
        "active_from": "2024-11-07",
        "content_vue_file": "terms-of-use/version-2.vue"
      }
    },
    ...
  ]
}

@dena I also thought the same. Could you put your comment in the PR? I think @Rosalie_WMDE may miss your comment :)

@dang @Rosalie_WMDE I brought this data shape topic up in the seniors round; Seems like a lot of thought already went into this endpoint spec and it was clarified that we should stick to the example in the ticket. Sorry for leading you off in another direction.

dena removed dena as the assignee of this task.Jul 15 2026, 1:57 PM
dena subscribed.
dena removed dena as the assignee of this task.Jul 16 2026, 1:21 PM
dena moved this task from Doing to Waiting for Peer Review on the Wikibase Cloud (Kanban Board) board.
dena updated the task description. (Show Details)

live test for staging:

$ curl -Ls https://wikibase.dev/api/v1/policies/current | jq
{
  "items": [
    {
      "metadata": {
        "policy_id": 1,
        "type": "terms-of-use",
        "active_from": "2022-01-01",
        "content_vue_file": "terms-of-use/version-1.vue"
      }
    },
    {
      "metadata": {
        "policy_id": 2,
        "type": "hosting-policy",
        "active_from": "2026-07-01",
        "content_vue_file": "hosting-policy/version-1.vue"
      }
    }
  ]
}

live test for production:

$ curl -Ls https://wikibase.cloud/api/v1/policies/current | jq
{
  "items": [
    {
      "metadata": {
        "policy_id": 1,
        "type": "terms-of-use",
        "active_from": "2022-01-01",
        "content_vue_file": "terms-of-use/version-1.vue"
      }
    }
  ]
}
Ollie.Shotton_WMDE renamed this task from πŸ“œ [Platform API] Create endpoint to get polices that should be accepted to πŸ“œ Create endpoint to get polices that should be accepted.Mon, Aug 10, 9:29 AM