Search: get page by token

GET {{url}}/{{tenantName}}/{{instanceName}}/patients/{{patientId}}/chat/search?pageToken=eyJ0eXBlIjoiTE9DQUxfRklORCIsInBhZ2VTaXplIjoyLCJib3JkZXJEYXRlIjoiMjAyMS0wMy0wNVQxNjowNzozMS4yOThaIiwiYmVmb3JlIjp0cnVlfQ==

Response fields:

FieldDescription
meta.nextPageTokenToken for fetching next search page
meta.prevPageTokenToken for fetching previous search page
content.[].meta.nextPageTokenToken for fetching messages which are located next to the found message. Should use in the get messages api.
content.[].meta.prevPageTokenToken for fetching messages which are located back to the found message. Should use in the get messages api.

Fetching next search page

  1. HTTP Method: GET
  2. 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

  1. HTTP Method: GET
  2. 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

KeyDatatypeRequiredDescription
pageTokenstringtoken for fetching next or previous search results, mutually exclusive with others params