Page MenuHomePhabricator

Reader reads a page slot online
Closed, InvalidPublic

Description

"As a Reader, I want to read a page slot with HTML separate from the JSON, so I can load the HTML as fast as possible."

As with T234377, we want separate endpoints for metadata and HTML so that it loads fast.

GET /page/{title}/slot/{role}/bare

Gets the metadata about the slot without the HTML attached.

Request body: none

Notable request headers: none

Status codes:

  • 200: the response body is the slot
  • 401: reading this slot requires the user to be authenticated and they are not
  • 403: the user is forbidden to read this slot
  • 404: there is no page with this title or that page has no slot with this role

Notable response headers: none

Response body: JSON object, with the following properties

  • id: id of the slot
  • content_model: content model of the slot

GET /page/{title}/slot/{role}/html

Gets HTML for the slot, not embedded in JSON.

Request body: none

Notable request headers: none

Status codes:

  • 200: the response body is the HTML
  • 400: this slot content model or role cannot be rendered as HTML
  • 401: reading this slot requires the user to be authenticated and they are not
  • 403: the user is forbidden to read this slot
  • 404: there is no page with this title or that page has no slot with this role

Notable response headers: none

Response body: HTML, rendered representation of the slot