API Export Search Results
Overview
The web application does not return search results when the result count is greater than 5,000 records.
A User can see the records by performing an export of the search and downloading the generated excel file with all of the records.
Similarly, the API will not return a result with more than 5,000 records. Instead, the API will return a 200 OK response with the following message:
{
"count": 6887,
"limitExceeded": true
}
Exporting Search Results
As an example, say we have the following search request:
POST https:securelb.trackerproducts.com/api/items/search
{
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": [ ],
"StaticFields": [
{
"name": "ITEM_DATE_CREATED",
"typeId": 2,
"fieldName": "DateCreated",
"searchCriteriasType": 2,
"searchCriterias": [],
"searchCriteria": 8,
"model": "2019-01-01T05:00:00.000Z",
"toDate": "2019-10-20T04:00:00.000Z"
},
{
"name": "SEARCH.OFFICE_SELECTION",
"typeId": 7,
"fieldName": "OfficeSelection",
"searchCriteriasType": 5,
"dropdownEntities": {
"entity": "offices"
},
"searchCriterias": [ ],
"selectedOffices": [ ],
"model": [ ],
"searchCriteria": 0
}
],
"officeIds": [ 504, 231, 1, 385, 911 ],
"orderBy": "PrimaryCaseNumber",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-07-02T17:41:07.518Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ]
}
This will return the following message:
{
"count": 6887,
"limitExceeded": true
}
Now we will use the following endpoint to export the search results to an Excel file.
exportTime is your current time in a 24 hour format
iANAZone is your time zone
See iANAZone ListtimeZoneOffset is your offset in minutes. For example, Eastern time zone is currently -4:00 from UTC time, so in minutes this is -240
The body of your request will have the same search as in the above post to api/items/search
{
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": [ ],
"StaticFields": [
{
"name": "ITEM_DATE_CREATED",
"typeId": 2,
"fieldName": "DateCreated",
"searchCriteriasType": 2,
"searchCriterias": [],
"searchCriteria": 8,
"model": "2019-01-01T05:00:00.000Z",
"toDate": "2019-10-20T04:00:00.000Z"
},
{
"name": "SEARCH.OFFICE_SELECTION",
"typeId": 7,
"fieldName": "OfficeSelection",
"searchCriteriasType": 5,
"dropdownEntities": {
"entity": "offices"
},
"searchCriterias": [ ],
"selectedOffices": [ ],
"model": [ ],
"searchCriteria": 0
}
],
"officeIds": [ 504, 231, 1, 385, 911 ],
"orderBy": "PrimaryCaseNumber",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-07-02T17:41:07.518Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ]
}
This will return a 200 OK response (note there is no body in this response).
Now we will use the following endpoint to get our exported search status:
GET https://securelb.trackerproducts.com/api/exports
This returns all exports in the following format:
{
"id": 17930,
"userId": 12659,
"organizationId": 1,
"modelType": 0,
"modelTypeString": "Items",
"startDate": "2020-07-02T20:39:59.82+00:00",
"completeDate": null,
"totalRecords": 6887,
"exportedRecords": 2500,
"complete": false,
"cancelled": false,
"status": "In progress",
"s3Filename": "Items-07-02-20_20_40_14.286.csv",
"s3FileLink": null
}
Note that the export status is in progress, but complete is still false. When the export is complete the response will look like this:
{
"id": 17930,
"userId": 12659,
"organizationId": 1,
"modelType": 0,
"modelTypeString": "Items",
"startDate": "2020-07-02T20:39:59.82+00:00",
"completeDate": "2020-07-02T20:41:16.969876+00:00",
"totalRecords": 6887,
"exportedRecords": 6887,
"complete": true,
"cancelled": false,
"status": "Complete",
"s3Filename": "Items-07-02-20_20_40_14.286.csv",
}