Searching, Paging, and Sorting

For large datasets, Amberflo supports paging and sorting.

Endpoint

https://app.amberflo.io/customers/paging

Query string parameters

The following query string parameters are passed to the paging endpoint.

ParameterDescriptionDefault
sortProperty to sort on. Any valid customer object property:
id
customerName
customerEmail
createTime
updateTime
id
limitNumber of rows per page. Integer value.10
isAscendingtrue or false(descending)true
pageThe page index to be fetched. Integer value greater than 0. This is not required for the first page.1
searchThe search keyword to filter records. The search keyword will be searched in customerId, customerName, and customerEmail properties using contains logic.

In other words, it searches the entire field text for the occurrence of the search keyword.

If no search keyword, then all customers will be returned.

Response

Following is a sample response when customers are sorted by customerName in ascending for the search keyword inc and page size of 5.
/customers/paging?limit=5&sort=customerName&search=inc

{
    "items": [
        {
            "enabled": true,
            "customerName": "Avengers, Inc.",
          	"customerEmail":"[email protected]",
            "updateTime": 1620412138198,
            "createTime": 1620407940012,
            "id": "00e99cc3-8d07-4946-87fb-fd2fbdc3ada7",
            "customerId": "00e99cc3-8d07-4946-87fb-fd2fbdc3ada7"
        },
        {
            "enabled": true,
            "customerName": "Monsters, Inc.",
          	"customerEmail":"[email protected]",
            "updateTime": 1620407897347,
            "createTime": 1620407897347,
            "id": "0208c479-f72a-456e-9334-5affabc11530",
            "customerId": "0208c479-f72a-456e-9334-5affabc11530"
        },
        {
            "enabled": true,
            "customerName": "Oceanic Airlines, Inc.",
          	"customerEmail":"[email protected]",
            "updateTime": 1620407902792,
            "createTime": 1620407902792,
            "id": "04df2aa5-6455-4fd9-b7aa-08d53689379e",
            "customerId": "04df2aa5-6455-4fd9-b7aa-08d53689379e"
        },
        {
            "enabled": true,
            "customerName": "Omni Consumer Products, Inc.",
          	"customerEmail":"[email protected]",
            "updateTime": 1620407892070,
            "createTime": 1620407892070,
            "id": "073ce3e1-544b-47c2-83a8-dc29c9bd89e2",
            "customerId": "073ce3e1-544b-47c2-83a8-dc29c9bd89e2"
        },
        {
            "enabled": true,
            "customerName": "Stark Industries, Inc.",
          	"customerEmail":"[email protected]",
            "updateTime": 1620407934342,
            "createTime": 1620407934342,
            "id": "07908636-7509-4ee0-87c8-5a0273822f74",
            "customerId": "07908636-7509-4ee0-87c8-5a0273822f74"
        }
    ],
   "metadata": {
        "totalRowCount": 1668,
        "filteredRowCount": 20,
        "limit": 5,
        "page": 1,
        "totalFilteredPages": 4,
        "isAscending": true,
        "sort": "customerName",
        "search": "inc"
    }
}

items include the actual list of customers on the page, and metadata includes the paging information as explained in the next section.

Paging metadata

The paging metadata is returned by the API call. It helps the API to keep track of the current paging state.

"metadata": {
    "totalRowCount": 1668,
    "filteredRowCount": 20,
    "limit": 5,
    "page": 1,
    "totalFilteredPages": 4,
    "isAscending": true,
    "sort": "customerName",
    "search": "inc"
}
PropertyDescriptionExample
totalRowCountThe total number of customer records.1668
filteredRowCountNumber of records filtered for the search keyword. If no search keyword, then it is the same as totalRowCount.20
limitPage size. Obtained from search query.5
pageCurrent page index. Obtained from search query.1
totalFilteredPagesTotal number of pages after applying the search filter.4
isAscendingObtained from search query.true
sortSort column. Obtained from search query.customerName
searchSearch keyword. Obtained from search query.inc

Useful Queries

FunctionQuery
Search customers containing the text "labs"search=labs
Search customers containing the text "labs" and fetch the 10th pagesearch=labs&page=10
Get all customers sorted by name and fetch the 2nd pagesort=customerName&page=2
Get the latest created customers firstsort=createTime