Most collection endpoints support page‑based pagination and field‑level sorting.
Both features work the same way across all resources, so you can reuse the examples below verbatim.
Pagination parameters
Parameter | Type | Default | Allowed Values | Purpose |
---|---|---|---|---|
page | int | 1 | > = 1 | 1‑based page index. |
itemsPerPage | int | 30 | 30 / 100 / 300 / 500 | Number of items returned per page. |
Requests that omit both parameters return the first 30 items.
The maximum payload is capped at 500 items to keep responses fast.
# Second page, 100 items each
curl -G https://api.viously.com/v2/videos \
-d page=2 \
-d itemsPerPage=100 \
-H "Authorization: Bearer $TOKEN"
Paging metadata in the response
{
"@context": "/contexts/Video",
"@id": "/videos",
"@type": "hydra:Collection",
"hydra:member": [ /* … current page … */ ],
"hydra:totalItems": 427,
"hydra:view": {
"@id": "/videos?page=2&itemsPerPage=100",
"hydra:first": "/videos?page=1&itemsPerPage=100",
"hydra:previous": "/videos?page=1&itemsPerPage=100",
"hydra:next": "/videos?page=3&itemsPerPage=100",
"hydra:last": "/videos?page=5&itemsPerPage=100"
}
}
Use the links in hydra:view to iterate without rebuilding query strings manually.
Sorting
Sort any collection by appending one or more order[field]=direction
parameters. You can find the list of fields in the description of each endpoints.
Direction can be asc
or desc
(case‑insensitive).
Example | Description |
---|---|
order[createdAt]=desc | Newest first |
order[id]=asc | Sort by numeric ID ascending |
order[date]=desc&order[net_revenue]=desc | Multi‑column sort (date, then revenue) |
When multiple order[] are supplied, the sequence in the query string defines precedence.
Combining pagination & sorting
Both sets of parameters can be mixed freely:
/videos?page=3&itemsPerPage=100&order[createdAt]=desc