Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for page sample route #1083

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions app/assets/data/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,55 @@ paths:
description: successful operation
schema:
$ref: '#/definitions/SingleVersion'

'/pages/{page_id}/sampled':
get:
tags:
- pages and versions
summary: Get one version per day of a specific page.
description: >
⚠️ This endpoint is experimental, and may change!

Use this endpoint to get a lighter-weight history of a page's versions
by sampling at most one version per day. The result is an array of
objects representing each day, each with a complete Version object and a
count of versions on that day. Only days with captured versions are
included.

If you are displaying a history for a particular page (particularly a
frequently captured page, like `https://www.epa.gov/`), this can be a
more efficient and quick way to load the relevant information you might
need, rather than requesting every version of the page from
`/pages{page_id}/versions`.

As with other list endpoints, results are chunked. Follow the
`links.next` property of the response to get the next chunk of results.
(You can also iterate by manually making requests with sequential
`capture_time` parameters, but the `links.next` property willskip past
empty time ranges automatically for more efficient querying.)
consumes:
- application/json
produces:
- application/json
parameters:
- name: page_id
in: path
description: ID of Page to return
required: true
type: string
format: uuid4
- name: capture_time
in: query
description: >-
filter by capture time; may also be specified as a range given as
time..time such as 2017-04-01T10:00Z..2017-04-01T12:00Z
required: false
type: string
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/PageOfVersionDateSample'
'/pages/{page_id}/versions/{version_id}':
get:
tags:
Expand Down Expand Up @@ -1512,6 +1561,16 @@ definitions:
properties:
data:
$ref: '#/definitions/Version'
VersionDateSample:
type: object
properties:
time:
type: string
format: date
version_count:
type: integer
version:
$ref: '#/definitions/Version'
PageOfVersions:
type: object
properties:
Expand All @@ -1534,6 +1593,25 @@ definitions:
next:
type: string
format: uri
PageOfVersionDateSample:
type: object
properties:
links:
type: object
properties:
first:
type: string
format: uri
next:
type: string
format: uri
page:
type: string
format: uri
data:
type: array
items:
$ref: '#/definitions/VersionDateSample'
SingleChange:
type: object
properties:
Expand Down