GET method and use the _sort parameter to specify the sorting field, thereby adjusting the order of results according to business needs. Sort search supports sorting by a single search field or by a combination of multiple search fields.Patient resources by last name and first name.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. |
_sort | String | Yes | The name of the field(s) to sort by. One or multiple fields can be specified, separated by commas. |
_sort=family indicates sorting by last name._sort=family,given indicates sorting by last name first, then by first name.200 OK is typically returned. The response body is usually a Bundle resource, which contains a sorted list of resources and pagination information.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. |
entry | Array | The sorted result list. |
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 | Search hit mode. |
link | Array | Pagination link information. |
GET /INSTANCE_ID/fhir/Patient?_sort=family HTTP/1.1Host: HOSTNAMEAuthorization: Bearer <AccessToken>Accept: application/fhir+json
GET /INSTANCE_ID/fhir/Patient?_sort=family,given HTTP/1.1Host: HOSTNAMEAuthorization: Bearer <AccessToken>Accept: application/fhir+json
{"resourceType": "Bundle","id": "2d7b3566-1773-40b3-abd4-0c8ebdd6466f","meta": {"lastUpdated": "2026-07-08T21:24:05.941+08:00"},"type": "searchset","link": [{"relation": "self","url": "https://HOSTNAME/INSTANCE_ID/fhir/Patient?_sort=family"},{"relation": "next","url": "https://HOSTNAME/INSTANCE_ID/fhir?_getpages=2d7b3566-1773-40b3-abd4-0c8ebdd6466f&_getpagesoffset=2&_count=20&_bundletype=searchset"}],"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"},"name": [{"family": "Chalmers","given": ["James"]}]},"search": {"mode": "match"}},{"fullUrl": "https://HOSTNAME/INSTANCE_ID/fhir/Patient/199964","resource": {"resourceType": "Patient","id": "199964","meta": {"versionId": "1","lastUpdated": "2022-10-10T07:07:33.086-04:00"},"name": [{"family": "Chalmers","given": ["Peter"]}]},"search": {"mode": "match"}}]}
Error Code | Description |
400 Bad Request | The _sort parameter format is incorrect, or the sort field is invalid. |
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 sort parameter syntax is correct, but it fails business or rule validation. |
500 Internal Server Error | Internal server processing exception. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan