API Export Search Results

Overview

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.

POST https://securelb.trackerproducts.com/api/exports/items?exportTime=2020-07-02T20:11:59.820Z&iANAZone=America%2FNew_York&timeZoneOffset=-240

{

"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",

"s3FileLink": "https://safe-secure-media.s3.us-gov-east-1.amazonaws.com/Items-07-02-20_20_40_14.286.csv?X-Amz-Expires=60&response-content-disposition=inline&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIASS2VG4POS7ZZPJS3/20200702/us-gov-east-1/s3/aws4_request&X-Amz-Date=20200702T204142Z&X-Amz-SignedHeaders=host&X-Amz-Signature=db9880fdb537510c19190c30fb4bfbc583cf91d76cd7ea501ef52a1f674cd496"

}