API Reference

When dealing with an array of objects in the response, Engage allows you to request the following operations:

  • Pagination
  • Filtering response
  • Select fields
  • Sorting order

Pagination

This section outlines how to handle paginated responses

Total count of records

You can access the total # of records available by referring to the response header: x-total-count

Limiting # of records

When dealing with an array of objects in the response (e.g. list of users, historical transcript, etc.) Engage defaults to respond with up to 10 records in the response. This can be increased up to a maximum of 500 records by leveraging the query parameter -limit

For example:

https://api-us-site-1.imiengage.io/api/v1/users?limit=10

Accessing the next page

You can access the next page by setting a query param called offset in your request. Using this in conjunction with the limit operation will allow you to access subsequent pages of the response. Developers are expected to loop through until the x-total-count no. of records are retrieved.

You can calculate the number of pages using the formula below depending on the limit you set in the request.

var pageCount = (x-total-count)/(limit)

Filtering responses and supported operators

When dealing with an array of objects in the response (e.g. list of users, historical transcript, etc.) you can filter your response using the following operators and conditions:

Operators:
Data TypeSupported Operators
stringeq
booleaneq
datetimelt, gt, le, ge, eq
Conditions
Condition
AND
OR

For example

https://stagingenagageapi.imichat.io/api/v1/users?filter=createdAt>ge'2020-12-09 08:50:05.540'

Selected Fields

Developers can selectively request a partial response by specifying a query param called fields and include the properties that are of interest from the supported payload.

https://stagingenagageapi.imichat.io/api/v1/users?fields=firstName,lastName,loginId

Order by

Developers can request a sorting order of the response by specifying a query param called orderBy and specify the attribute to sort by.

https://stagingenagageapi.imichat.io/api/v1/users?orderBy=createdAt