tencent cloud

Pagination and Result Quantity Control

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-08-28 16:06:55
AI翻訳

API Description

This is used to paginate FHIR search results and control the number of records returned. The client can initiate a search request via the HTTP GET method. The server typically returns the result set in pages and provides links to subsequent pages in the response's Bundle.link. Additionally, the _count parameter can be used to control the number of records returned per page.
This example demonstrates the following two common scenarios:
Search results are returned in pages.
Use _count to control the number of items returned per request.

Input parameters

Parameter Name
Type
Required
Description
HTTP Method
String
Yes
Fixed as GET.
URL
String
Yes
The search address, in the format [baseUrl]/[resourceType]?[searchParams].
Authorization
String
Yes
The access token, in the format Bearer <AccessToken>. For details on how to obtain it, see Calling Method.
Accept
String
No
The response format. It is recommended to use application/fhir+json.
_count
Integer
No
Specifies the number of records to return per page. The default value is 20, and it must be a positive integer. The actual maximum value is constrained by the server configuration.
Other search parameters
Query String
No
Regular search criteria that can be used in combination with pagination parameters.
Note:
Search results are typically returned in pages by default.
The first page of results typically provides pagination links such as self and next.
When more results exist, you can use the next link to continue obtaining subsequent pages.
The _count parameter only controls the number of items returned per page. It does not change the total number of matching results.

Output Parameters

Upon a successful API call, the HTTP status code 200 OK is typically returned. The response body is usually a Bundle resource, which contains the current page of results, the total number, and pagination link information.
Key Response Body Field Descriptions:
Field
Type
Description
resourceType
String
Returns the resource type, usually Bundle.
id
String
The unique identifier of the current result set.
meta.lastUpdated
String
The generation time of the current result set.
type
String
The Bundle type is usually searchset in search scenarios.
total
Integer
The total number of matched records. This field may not be returned by default and is only returned when the server can efficiently calculate the total number of records. The current server does not support forcing the return of an accurate total via _total=accurate.
link
Array
Pagination link information.
link[].relation
String
The link relation, such as self and next.
link[].url
String
The access URL for the corresponding pagination.
entry
Array
The list of resources returned for the current page.

Examples

Example 1: Paginated Search Results

Request Example

GET /INSTANCE_ID/fhir/Patient?birthdate=1974-02-13 HTTP/1.1
Host: HOSTNAME
Authorization: Bearer <AccessToken>
Accept: application/fhir+json

Response Example

{
"resourceType": "Bundle",
"id": "3c4b5bfc-a03e-474c-9cb2-bd640022cf20",
"meta": {
"lastUpdated": "2022-10-13T14:07:20.613+00:00"
},
"type": "searchset",
"link": [
{
"relation": "self",
"url": "https://HOSTNAME/INSTANCE_ID/fhir/Patient?birthdate=1974-02-13"
},
{
"relation": "next",
"url": "https://HOSTNAME/INSTANCE_ID/fhir?_getpages=3c4b5bfc-a03e-474c-9cb2-bd640022cf20&_getpagesoffset=20&_count=20&_bundletype=searchset"
}
]
}

Example 2: Controlling the Number of Returned Results per Request

Request Example

GET /INSTANCE_ID/fhir/Observation?code=http://loinc.org%7C718-7&_count=20 HTTP/1.1
Host: HOSTNAME
Authorization: Bearer <AccessToken>
Accept: application/fhir+json

Response Example

HTTP/1.1 200 OK
Content-Type: application/fhir+json
x-request-id: ENqsVXqc5SeqLOfU
{
"resourceType": "Bundle",
"id": "3c4b5bfc-a03e-474c-9cb2-bd640022cf20",
"meta": {
"lastUpdated": "2022-10-13T14:07:20.613+00:00"
},
"type": "searchset",
"total": 45,
"link": [
{
"relation": "self",
"url": "https://HOSTNAME/INSTANCE_ID/fhir/Observation?code=http://loinc.org%7C718-7&_count=20"
},
{
"relation": "next",
"url": "https://HOSTNAME/INSTANCE_ID/fhir?_getpages=3c4b5bfc-a03e-474c-9cb2-bd640022cf20&_getpagesoffset=20&_count=20&_bundletype=searchset"
}
],
"entry": [
{
"fullUrl": "https://HOSTNAME/INSTANCE_ID/fhir/Observation/OBS001",
"resource": {
"resourceType": "Observation",
"id": "OBS001",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "718-7",
"display": "Hemoglobin [Mass/volume] in Blood"
}
]
}
},
"search": {
"mode": "match"
}
}
]
}

Error Codes

Common error codes are listed below. For more error codes, see Error Codes.
Error Code
Description
400 Bad Request
The pagination parameter or the _count parameter is in an incorrect format.
401 Unauthorized
Not authenticated, and valid credentials are missing.
403 Forbidden
Authenticated but not authorized to search the resource.
404 Not Found
The specified resource type does not exist.
422 Unprocessable Entity
The search parameter syntax is correct, but it fails business or rule validation.
500 Internal Server Error
Internal server processing exception


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック