tencent cloud

Date and Time Search API

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

API Description

This feature enables conditional search of resources based on date or time fields. The client can pass date-related search parameters in the URL via the HTTP GET method to filter resource records that meet specified conditions for dates, years, time ranges, or update times.
This example demonstrates common date and time search scenarios, including:
Search for patients by specified birth date.
Search for patients by specified year.
Search for medical visit records by date range.
Search for data by the resource's last update time.

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.
birthdate
String
No
Search by birthdate. Supports full dates (for example, 1974 - 02 - 13) or partial dates (for example, passing only the year 1974).
date
String
No
Search by date field. It can be combined with comparison prefixes such as ge and le.
_lastUpdated
String
No
Search by the last update time of the resource. The value is usually an ISO 8601 date-time.
subject
String
No
A reference search parameter. It can be used in combination with date parameters, for example, Patient/{id}.
Note:
Date parameters support both full dates and partial dates, such as passing only the year.
A date range is typically implemented by combining multiple parameters with the same name that have comparison prefixes.
The _lastUpdated parameter can be used for any resource type to filter data that was updated after or before a specified point in time.
Common comparison prefixes include ge, gt, le, lt, eq, and others.

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 a list of resources that meet the criteria and pagination information.
Key Response Body Field Descriptions:
Field
Type
Description
resourceType
String
Returns the resource type, usually Bundle.
id
String
Unique ID of the Bundle resource, usually a UUID.
meta
Object
Metadata of the Bundle, containing fields such as lastUpdated.
meta.lastUpdated
String
Generation time of the Bundle.
type
String
The Bundle type is usually searchset in search scenarios.
total
Integer
The total number of matched records. Returned only when _total=accurate is passed in the request; this field may not be included if the parameter is not passed.
link
Array
Pagination link information, containing relation and url.
link[].relation
String
Type of the link relation, such as self, next, and previous.
link[].url
String
The complete request URL for the corresponding pagination.
entry
Array
The list of search results.
entry[].fullUrl
String
The complete access URL of the resource.
entry[].resource
Object
The matched resource content.
entry[].resource.id
String
Unique ID of the resource.
entry[].resource.meta
Object
Metadata of the resource, containing fields such as versionId and lastUpdated.
entry[].search.mode
String
The search hit mode, such as match.
Note:
The total field may not be returned by default. To obtain the total number of hits, include _total=accurate in the request parameters. The server will then calculate and return the total. If the _total parameter is not included, the response body may not contain the total field.

Examples

Request Example

Example 1: Search for patients whose birth date matches the specified date.
GET /INSTANCE_ID/fhir/Patient?birthdate=1974-02-13 HTTP/1.1
Host: HOSTNAME
Authorization: Bearer <AccessToken>
Accept: application/fhir+json
Example 2: Search for patients born in the specified year.
GET /INSTANCE_ID/fhir/Patient?birthdate=1974 HTTP/1.1
Host: HOSTNAME
Authorization: Bearer <AccessToken>
Accept: application/fhir+json
Example 3: Search for medical visit records within a specified date range.
GET /INSTANCE_ID/fhir/Encounter?subject=Patient/ef2c19c4-ea06-473d-8781-368e4441c5c0&date=ge2009-06-01&date=le2009-07-31 HTTP/1.1
Host: HOSTNAME
Authorization: Bearer <AccessToken>
Accept: application/fhir+json
Example 4: Search for patient resources that were updated after a specified point in time.
GET /INSTANCE_ID/fhir/Patient?_lastUpdated=ge2017-01-01T00:00:00Z HTTP/1.1
Host: HOSTNAME
Authorization: Bearer <AccessToken>
Accept: application/fhir+json

Response Example

{
"resourceType": "Bundle",
"id": "180f7368-790e-4f2b-b24a-550eb027d747",
"meta": {
"lastUpdated": "2022-10-10T07:07:33.086-04:00"
},
"type": "searchset",
"link": [
{
"relation": "self",
"url": "https://HOSTNAME/INSTANCE_ID/fhir/Patient?birthdate=1974-02-13"
}
],
"entry": [
{
"fullUrl": "https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963",
"resource": {
"resourceType": "Patient",
"id": "199963",
"meta": {
"versionId": "1",
"lastUpdated": "2022-10-10T07:07:33.086-04:00"
},
"birthDate": "1974-02-13"
},
"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 date parameter format is incorrect, or the comparison prefix is used illegally.
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.


ヘルプとサポート

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

フィードバック