Not logged in - Login

Custom Search Cases

SEARCH BASICS

  • All searches are done as POST requests to the API.
  • Search parameters are sent in the body of a request in a JSON format.
  • All search request bodies must contain a "StaticFields" array, an "OfficeIds" array, and also paging parameters properties "PageSize" and "PageNumber".
  • "OfficeIds" must be included in the request and allows a search to filter by Office.
  • As options, the request can also include "orderBy" which will be a field name and "orderByAsc" which can be either true or false.

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. The criteria are different depending on the field. For easier reference, the search criteria can be broken down into the following groups:

Group 1 - TEXT FIELDS

Text Fields can be searched with the following criteria:

- Equals, Not Equals, Starts With, Text Search
These criteria are represented as follows:
Equals:
{
"id": 0,
},
Not Equals
{
"id": 1,
},
Starts With
{
"id": 2,
},
Text Search
{
"id": 25,
}

Group 2 - DATE FIELDS

Date Fields can be searched with the following criteria:
( Note - X is number of days)
- Before, After, Between, Exactly, Newer than X, Older than X, Between X and Y, Current Week, Last Week, Month To Date, Last Month, Year To Date, Last Year
These criteria are represented as follows:
Before
{
"id": 6,
},
After
{
"id": 7,
},
Between
{
"id": 8,
},
Exactly
{
"id": 13,
},
Newer Than
{
"id": 12,
},
Older Than
{
"id": 11,
},
Between X and Y
{
"id": 18,
},
Current Week
{
"id": 19,
},
LastWeek
{
"id": 20,
},
Month To Date
{
"id": 21,
},
Last Month
{
"id": 22,
},
Year To Date
{
"id": 23,
},
Last Year
{
"id": 24,
}

Group 3 - DROPDOWN FIELDS

Dropdown fields can be searched with 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.

Group 4 - BOOLEAN FIELDS

Boolean fields (true or false) can be searched with the following criteria:
- Equals, Not Equals
These criteria are represented as follows:
Equals
{
"id": 0,
},
Not Equals
{
"id": 1,
},

Field Types

Field Types are specified using Ids, and are included in the body as "typeId"
These are the field types and their Ids:

  • TEXTFIELD: 0,
  • TEXTAREA: 1,
  • DATE: 2,
  • DROPDOWN: 3,
  • BOOLEAN: 4,
  • TYPEAHEAD: 5,
  • LOCATION: 6,
  • MULTIPLECHECKBOX: 7,
  • NUMBER: 8*

CASE SEARCH

The following fields can be searched for cases:
Note the field name in parentheses - this will be used in our search request body

Group 1 Text Fields

  • Case Number (CaseNumber)

  • Offense Location (OffenseLocation)

  • Offense Description (OffenseDescription)

  • Review Date Notes (ReviewDateNotes) - This is only valid if Auto Disposition is on for organization.

Group 2 - Dates

  • Created Date (CreatedDate)
  • Offense Date (Offense Date)
  • Closed Date (Closed Date)
  • Review Date (ReviewDate) - This is only valid if Auto Disposition is on for organization.

Group 3 - Dropdown Fields

  • Offense Type (OffenseType)       
  • Saved Searches Of Items

Group 4 - Boolean Fields

  • Active (Active)
  • Created By (CreatedBy) - accepts User Id
  • Case Officer (CaseOfficer) - accepts User Id
  • Tags (Tags) - accepts a user Id

Examples

Here is the endpoint for a case search:
POST - https://{your api url}/api/cases/search

Text Field Search

Here is the body for a search with a text field.
We are searching the case number field where the text equals "2020-0318-01".
This value is added in the "model" property of the request body
Note that for "searchCriteria" we need to only provide the criteria id
Also note the "typeId" property is the field type as outlined above.

POST https://{api url}/api/cases/search

{
"StaticFields": [
{
"name": "CASE_NUMBER",
"typeId": 0,
"fieldName": "CaseNumber",
"searchCriterias": [
],
"searchCriteria": 0,
"model": "2020-0318-01"
}
],
"officeIds": [
608,
607
],
"orderBy": "Active",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-03-19T20:57:27.372Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ],
"tags": [ ],
"IsSearchingInSublocations": false,
"DynamicFields": [ ]
}

Group 2 - Date Fields

Here is an example of a Date field search
We are searching a date of birth between the dates 01-01-2020 and 03-01-2020.
The "typeId" is now changed to the value corresponding to field type date
Note that "model" is the start date of the search and "toDate" is the to date.
Also, dates can be searched with just day, month, and year or can be a full date with time.
So, the "model" below could also be "2020-03-01T04:00:00.000Z"

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

{


"StaticFields": [
{
"name": "GENERAL.CREATED_DATE",
"typeId": 2,
"fieldName": "CreatedDate",
"searchCriteriasType": 2,
"searchCriteria": 8,
"toDate": "2020-03-01T05:00:00.000Z",
"model": "2020-01-01T05:00:00.000Z"
}
],
"officeIds": [
608,
607
],
"orderBy": "Active",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-03-19T21:19:07.310Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ],
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": []
}


Here is a search of cases with a created date in the last year:
Note that the "model" is not needed for this search type.

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

"StaticFields": [
{
"name": "GENERAL.CREATED_DATE",
"typeId": 2,
"fieldName": "CreatedDate",
"searchCriteriasType": 2,
"searchCriteria": 23,
"toDate": null,
"model": null
}
],
"officeIds": [
608,
607
],
"orderBy": "Active",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-03-19T21:19:07.310Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ],
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": []
}

Another type of date search is Newer Than and Older Than. This search uses the searchCriteria of 12, the model is the number of days, and the toDate is the current date. To search for all cases created within the last 30 days, the search would look like the following:

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

"StaticFields": [
{
"name": "GENERAL.CREATED_DATE",
"typeId": 2,
"fieldName": "CreatedDate",
"searchCriteriasType": 2,
"searchCriteria": 12,
"toDate": "2020-06-09T04:00:00.000Z",
"model": 30
}
],
"officeIds": [
608,
607
],
"orderBy": "Active",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-06-09T21:19:07.310Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ],
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": []
}

Group 3 - Dropdown Fields

In order to search these fields you will first need to get the Ids that will be used as our "model" values

Case Offense types:



This will return an organization's offense types. Here is an example of the returned data:


[
{
"organizationOffenseTypeFollowUpDays": null,
"id": 158,
"name": "Accident",
"active": true,
"offenseTypeForms": null,
"organizations": [],
"autoDispositionSettings": [],
"customDropdownCategoryId": 1,
"customDropdownCategory": null
},
{
"organizationOffenseTypeFollowUpDays": null,
"id": 89,
"name": "Adoption",
"active": true,
"offenseTypeForms": null,
"organizations": [],
"autoDispositionSettings": [],
"customDropdownCategoryId": 1,
"customDropdownCategory": null
},


The important data here is the id - this will be used in the search.
To search for all cases with an offense type of "Accident", the search would look like the following:

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

{

"StaticFields": [
{
"name": "CASE_OFFENSE_TYPE",
"typeId": 3,
"fieldName": "OffenseTypeId",
"searchCriteriasType": 1,
"dropdownEntities": {
"entity": "offenseTypes",
"options": {
"belongToOrganization": true
}
},
"searchCriterias": [ ],
"dropdownValues": [],
"searchCriteria": 0,
"model": 158
}
],
"officeIds": [
608,
607
],
"orderBy": "Active",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-03-19T21:19:07.310Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ],
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": []
}


"model" is offense type id


Dropdown fields can also be searched with not equals criteria.

To do so, just change searchCriteria to 1
Here is a search of all cases whose offense type is NOT 'Accident':

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

{

"StaticFields": [
{
"name": "CASE_OFFENSE_TYPE",
"typeId": 3,
"fieldName": "OffenseTypeId",
"searchCriteriasType": 1,
"dropdownEntities": {
"entity": "offenseTypes",
"options": {
"belongToOrganization": true
}
},
"searchCriterias": [ ],
"dropdownValues": [],
"searchCriteria": 0,
"model": 158
}
],
"officeIds": [
608,
607
],
"orderBy": "Active",
"orderByAsc": false,
"PageSize": 25,
"peopleIds": [ ],
"PageNumber": 1,
"clientDate": "2020-03-19T21:19:07.310Z",
"clientTz": "America/New_York",
"timezoneOffset": 240,
"SavedSearchEntities": [ ],
"tags": [],
"IsSearchingInSublocations": false,
"DynamicFields": []
}