API - Saved Searches


Saved Searches

Search Criteria

The body of a search request must include a search criteria. These criteria Ids are used in the "searchCriteria" property of the request body. Saved Searches are a type of dropdown field. They use the following criteria:

- Equals, Not Equals, Select All

These criteria are represented as follows

Equals

{

"id": 0,

},

Not Equals

{

"id": 1,

},

Select All is the default and does not need to be specified in the search request body.

To show how the saved searches work, here is a basic case search for cases created in the last 30 days:

POST - https://securelb.trackerproducts.com/api/cases/search

{

"tags": [ ],

"IsSearchingInSublocations": false,

"DynamicFields": [ ],

"StaticFields": [

{

"name": "GENERAL.CREATED_DATE",

"typeId": 2,

"fieldName": "CreatedDate",

"searchCriteriasType": 2,

"searchCriterias": [ ],

"searchCriteria": 12,

"model": 30,

"toDate": "2020-06-09T04:00:00.000Z"

},

{

"name": "SEARCH.OFFICE_SELECTION",

"typeId": 7,

"fieldName": "OfficeSelection",

"searchCriteriasType": 5,

"dropdownEntities": {

"entity": "offices"

},

"searchCriterias": [

{

"id": 0,

"name": "TP_SEARCH.SEARCH_CRITERIA.EQUALS"

}

],

"selectedOffices": [ ],

"model": [ ],

"searchCriteria": 0

}

],

"officeIds": [

1,

175,

231,

385

],

"orderBy": "CaseNumber",

"orderByAsc": false,

"PageSize": 25,

"peopleIds": [ ],

"PageNumber": 1,

"clientDate": "2020-06-09T20:11:28.651Z",

"clientTz": "America/New_York",

"timezoneOffset": 240,

"SavedSearchEntities": [ ]

}



To create a saved search, we will use the following endpoint:

POST - https://securelb.trackerproducts.com/api/savedSearches



The request should contain

Here is the body of the POST:


{

"name": "Cases Created In Last 30 Days",

"model": "cases",

"searchParameters": "

{\"fields\":

[ {

\"fieldName\":\"CreatedDate\",

\"searchCriteria\":12,

\"model\":30,

\"toModel\":null

},

{

\"fieldName\":\"OfficeSelection\",

\"searchCriteria\":0,

\"model\":

[ {

\"id\":1,

\"name\":\"Tracker Products - Local - 1 Office, LLC\",

\"selected\":true

},

{

\"id\":231,

\"name\":\"Tracker Products - Local - 231 Office\",

\"selected\":true

} ]

} ],

\"forms\":[],

\"isHistorySearch\":false,

\"selectedOfficesIds\":[1,231],

\"searchSublocations\":false,

\"tagsToSearch\":[],

\"peopleIds\":[]}",

"isHistorySearch": false

}