Search: get page by token
GET {{url}}/{{tenantName}}/{{instanceName}}/patients/{{patientId}}/chat/search?pageToken=eyJ0eXBlIjoiTE9DQUxfRklORCIsInBhZ2VTaXplIjoyLCJib3JkZXJEYXRlIjoiMjAyMS0wMy0wNVQxNjowNzozMS4yOThaIiwiYmVmb3JlIjp0cnVlfQ==
Response fields:
Field | Description |
---|---|
meta.nextPageToken | Token for fetching next search page |
meta.prevPageToken | Token for fetching previous search page |
content.[].meta.nextPageToken | Token for fetching messages which are located next to the found message. Should use in the get messages api. |
content.[].meta.prevPageToken | Token for fetching messages which are located back to the found message. Should use in the get messages api. |
Fetching next search page
- HTTP Method: GET
- HTTP URL:
https://api.live.welkincloud.io/gh/sb-demo/patient/7272b601-bb09-4abf-87c0-ade48ddfaea0/chat/search?pageToken=eyJ0eXBlIjoiTE9DQUxfU0VBUkNIIiwicGFnZVNpemUiOjIsImJvcmRlckRhdGUiOiIyMDIxLTAzLTA5VDIzOjUzOjA4LjkyNloiLCJxdWVyeSI6ImhlbGxvIiwiYmVmb3JlIjp0cnVlfQ==
And we received “Hello0” message, that’s the last message that matches query.
Fetch near-located messages
Let imagine the following situation: the user clicked on the found message, and we would like to open chat dialog and jump to the message. So we have to see messages that located near the found message.
So we’re using the following request and pass “content[].meta.nextPageToken” as pageToken param:
Note: We are not using search API, we are using get messages api
- HTTP Method: GET
- HTTP Url:
https://api.live.welkincloud.io/gh/sb-demo/patient/7272b601-bb09-4abf-87c0-ade48ddfaea0/chat?pageToken=eyJ0eXBlIjoiTE9DQUxfRklORCIsInBhZ2VTaXplIjoxLCJib3JkZXJEYXRlIjoiMjAyMS0wMy0wOVQyMzo1NDozOS4xNTJaIiwiYmVmb3JlIjp0cnVlfQ==&includeArchived=false
As you can see, fetched message Test2
located next to the found message Hello2
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
pageToken | string | token for fetching next or previous search results, mutually exclusive with others params |