API - Custom Search - People

SEARCH BASICS

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:

PEOPLE SEARCH

The following fields can be searched for people:

Note the field name in parentheses - this will be used in our search request body

Group 1

Group 2

Group 3

Group 4

       * Deceased (Deceased)       

Examples

Here is the endpoint for a people search:

This is a POST request.

Text Field Search

Here is the body for a search with a text field.

We are searching the first name field where the name equals "Captain".

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://securelb.trackerproducts.com/api/people/search

{

"StaticFields": [

{

"name": "GENERAL.FIRSTNAME",

"typeId": 0,

"fieldName": "FirstName",

"searchCriteria": 0,

"model": "Captain"

}

],

"officeIds": [


],

"orderBy": "LastName",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1

}


And this search brings back the following result:

{

"count": 1,

"data": [

{

"formDataParsed": [


],

"id": 1634888,

"guid": "8552bf58-65a9-47ba-8aa4-e1664109420a",

"organizationId": 1,

"userId": null,

"createDateTime": "2018-06-12T17:23:54.521Z",

"updatedDateTime": "2018-07-05T11:11:35.508Z",

"isDeleted": null,

"businessName": "",

"businessNameLC": "",

"name": "Captain Crunch",

"nameLC": "captain crunch",

"firstName": "Captain",

"firstNameLC": "captain",

"middleName": "",

"middleNameLC": null,

"lastName": "Crunch",

"lastNameLC": "crunch",

"alias": "",

"aliasLC": "",

"driverLicence": "",

"mobilePhone": "",

"otherPhone": "",

"email": "",

"dob": null,

"raceId": 1,

"race": "Unknown",

"genderId": 1,

"gender": "Unknown",

"deceased": false,

"juvenile": false,

"active": true,

"personTypeId": null,

"formData": null,

"formDataAmount": 0,

"notes": [ ],

"notesAmount": 0,

"media": [ ],

"mediaAmount": 0,

"rootMediaFolderId": 163767,

"externalOrganizationIds": [ ],

"displayedName": null,

"defaultAddress": "12305 N 128th Drive, , El Mirage, Arizona, 85335",

"isForbidden": false

}

]

}

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-1962 and 08-01-1962.

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 "1962-06-01T04:00:00.000Z"

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

{

"StaticFields": [

{

"name": "GENERAL.DOB",

"typeId": 2,

"fieldName": "Dob",

"searchCriteria": 8,

"toDate": "1962-08-01",

"model": "1962-01-01"

}

],

"officeIds": [


],

"orderBy": "BusinessName",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1


}


This returned the following person:

{

"count": 1,

"data": [

{

"formDataParsed": [ ],

"id": 1634888,

"guid": "8552bf58-65a9-47ba-8aa4-e1664109420a",

"organizationId": 1,

"userId": null,

"createDateTime": "2018-06-12T17:23:54.521Z",

"updatedDateTime": "2018-07-05T15:44:20.273Z",

"isDeleted": null,

"businessName": "",

"businessNameLC": "",

"name": "Captain Crunch",

"nameLC": "captain crunch",

"firstName": "Captain",

"firstNameLC": "captain",

"middleName": "",

"middleNameLC": null,

"lastName": "Crunch",

"lastNameLC": "crunch",

"alias": "",

"aliasLC": "",

"driverLicence": "",

"mobilePhone": "",

"otherPhone": "",

"email": "",

"dob": "1962-07-01T00:00:00Z",

"raceId": 1,

"race": "Unknown",

"genderId": 1,

"gender": "Unknown",

"deceased": false,

"juvenile": false,

"active": true,

"personTypeId": null,

"formData": [ ],

"formDataAmount": 0,

"notes": [ ],

"notesAmount": 0,

"media": [ ],

"mediaAmount": 0,

"rootMediaFolderId": 163767,

"externalOrganizationIds": [ ],

"displayedName": null,

"defaultAddress": "12305 N 128th Drive, , El Mirage, Arizona, 85335",

"isForbidden": false

}

]

}

Here is a search of people with a date of birth in the last year:

Note that the "model" is not needed for this search type.

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

{

"StaticFields": [

{

"name": "GENERAL.DOB",

"typeId": 2,

"fieldName": "Dob",

"searchCriteria": 24

}

],

"officeIds": [


],

"orderBy": "LastName",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1

}


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

Genders:

GET - https://securelb.trackerproducts.com/api/genders


An example of the return data:

[

{

"id": 2,

"name": "Female",

"active": true

},

{

"id": 3,

"name": "Male",

"active": true

},

{

"id": 1,

"name": "Unknown",

"active": true

}

]

Races:

GET - https://secure.trackerproducts.com/api/races


[

{

"id": 2,

"name": "African American or Black",

"active": true

},

{

"id": 3,

"name": "American Indian or Alaska Native",

"active": true

},

{

"id": 4,

"name": "Asian",

"active": true

},

{

"id": 7,

"name": "Hispanic",

"active": true

},

{

"id": 8,

"name": "Middle Eastern",

"active": true

},

{

"id": 5,

"name": "Native Hawaiian or Other Pacific Islander",

"active": true

},

{

"id": 1,

"name": "Unknown",

"active": true

},

{

"id": 6,

"name": "White",

"active": true

}

]

You can also combine criteria for a search.

Here is a search which will find all First name people equal to Barney, and gender equal to Male

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

{

"StaticFields": [

{

"name": "GENERAL.FIRSTNAME",

"typeId": 0,

"fieldName": "FirstName",

"searchCriteria": 0,

"model": "Barney"

},

{

"name": "GENERAL.GENDER",

"typeId": 3,

"fieldName": "GenderId",

"searchCriteria": 0,

"model": 3

}

],

"officeIds": [


],

"orderBy": "BusinessName",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1

}


This returned two results:

{

"count": 2,

"data": [

{

"formDataParsed": [],

"id": 1634902,

"guid": "ce2cd2da-1029-43ae-88ef-5cfc005322c3",

"organizationId": 1,

"userId": null,

"createDateTime": "2018-07-02T12:46:25.375Z",

"updatedDateTime": null,

"isDeleted": null,

"businessName": "",

"businessNameLC": "",

"name": "Barney Rubble",

"nameLC": "barney rubble",

"firstName": "Barney",

"firstNameLC": "barney",

"middleName": "",

"middleNameLC": null,

"lastName": "Rubble",

"lastNameLC": "rubble",

"alias": "Rocks",

"aliasLC": "rocks",

"driverLicence": "oh 78965",

"mobilePhone": "",

"otherPhone": "",

"email": "moonrocks@gmail.com",

"dob": "1969-07-05T00:00:00Z",

"raceId": 6,

"race": "White",

"genderId": 3,

"gender": "Male",

"deceased": false,

"juvenile": false,

"active": true,

"personTypeId": null,

"formData": [ ],

"formDataAmount": 0,

"notes": [ ],

"notesAmount": 0,

"media": [ ],

"mediaAmount": 0,

"rootMediaFolderId": 173786,

"externalOrganizationIds": [ ],

"displayedName": null,

"defaultAddress": "1080 Fountain Head Lane, , Lawrenceville, Georgia, 30043",

"isForbidden": false

},

{

"formDataParsed": [ ],

"id": 1634901,

"guid": "f017447c-3235-4f86-98c3-79d9db9dda7e",

"organizationId": 1,

"userId": null,

"createDateTime": "2018-07-02T11:41:55.213Z",

"updatedDateTime": null,

"isDeleted": null,

"businessName": "",

"businessNameLC": "",

"name": "Barney Miller",

"nameLC": "barney miller",

"firstName": "Barney",

"firstNameLC": "barney",

"middleName": "",

"middleNameLC": null,

"lastName": "Miller",

"lastNameLC": "miller",

"alias": "Barn Dog",

"aliasLC": "barn dog",

"driverLicence": "oh 12345",

"mobilePhone": "",

"otherPhone": "",

"email": "bmiller@gmail.com",

"dob": "1970-09-12T00:00:00Z",

"raceId": 1,

"race": "Unknown",

"genderId": 3,

"gender": "Male",

"deceased": false,

"juvenile": false,

"active": true,

"personTypeId": null,

"formData": [],

"formDataAmount": 0,

"notes": [ ],

"notesAmount": 0,

"media": [ ],

"mediaAmount": 0,

"rootMediaFolderId": 173785,

"externalOrganizationIds": [ ],

"displayedName": null,

"defaultAddress": "203 N. Maple Ave., , Excelsior Springs, Missouri, 64024",

"isForbidden": false

}

]}

Dropdown fields can also be searched with not equals criteria.

Here is a search of all people whose race is NOT unknown:

"model" is raceId

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

{

"StaticFields": [

{

"name": "GENERAL.RACE",

"typeId": 3,

"fieldName": "RaceId",

"searchCriteria": 1,

"model": 1

}

],

"officeIds": [


],

"orderBy": "BusinessName",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1

}


Group 4 - Boolean Fields

Boolean fields can be searched by specifying true or false in the "model" property of the search request body.

Here is a search of all people in the system with a value of deceased equal to true:

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

"StaticFields": [

{

"name": "GENERAL.DECEASED",

"typeId": 4,

"fieldName": "Deceased",

"searchCriteria": 0,

"model": true

}

],

"officeIds": [


],

"orderBy": "BusinessName",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1

}



This returns the following result:

{

"count": 1,

"data": [

{

"formDataParsed": [ ],

"id": 261310,

"guid": "c8f9721a-c8fb-42d8-aea9-9ef469343410",

"organizationId": 1,

"userId": null,

"createDateTime": "2016-05-19T04:43:34.072Z",

"updatedDateTime": "2018-07-05T17:48:54.335Z",

"isDeleted": null,

"businessName": "",

"businessNameLC": "",

"name": "Jacob Smith",

"nameLC": "jacob smith",

"firstName": "Jacob",

"firstNameLC": "jacob",

"middleName": "",

"middleNameLC": null,

"lastName": "Smith",

"lastNameLC": "smith",

"alias": "",

"aliasLC": "",

"driverLicence": "1234",

"mobilePhone": "Mobile",

"otherPhone": "Other",

"email": "",

"dob": "1974-06-01T00:00:00Z",

"raceId": 4,

"race": "Asian",

"genderId": 3,

"gender": "Male",

"deceased": true,

"juvenile": false,

"active": true,

"personTypeId": null,

"formData": [

{

"id": "573d44971b5c5e16886812d3",

"active": true,

"entityId": 261310,

"formId": 398,

"formName": "BsonNull",

"dateFields": null,

"data": "{}",

"organizationId": 1,

"officeId": 1,

"visibilityId": 1

}

],

"formDataAmount": 1,

"notes": [ ],

"notesAmount": 0,

"media": [ ],

"mediaAmount": 0,

"rootMediaFolderId": 173795,

"externalOrganizationIds": [ ],

"displayedName": null,

"defaultAddress": "n/a",

"isForbidden": false

}

]

}