Skip to content

Paginated

A 200 response with a paginated list of items.

ParameterTypeDescription
statusintegerThe HTTP status code
messagestringThe message to return
itemsarrayItems from the current page
paginationInfoPaginationInfoDetails about the pagination

An example paginated response:

{
"status": 200,
"message": "Success",
"items": [
{
"id": "123",
"name": "Test 1"
},
{
"id": "124",
"name": "Test 2"
}
],
"paginationInfo": {
"page": 1,
"pageSize": 10,
"totalItems": 25,
"totalPages": 3
}
}

Here’s an example of how to use the Paginated response within a an API operation:

import "@common-grants/core";
import "@typespec/http";
using TypeSpec.Http;
using CommonGrants.Pagination;
using CommonGrants.Responses;
model TestModel {
id: string;
name: string;
}
@summary("List test models")
@doc("Get a paginated list of test models")
@get
op listTest(...PaginatedQueryParams): Paginated<TestModel>;