API Transaction Searches

Transaction Searches

There are 5 types of transactions that can be searched in the system:


1.) Check Ins

2.) Check Outs

3.) Transfers

4.) Moves

5.) Disposals

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:

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,

},

Contains

{

"id": 4,

},

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,

}

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.

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,

},

TYPE AHEAD FIELDS

Type ahead fields use a boolean style search to match ids returned in text searches :

- Equals, Not Equals

The "model" value for these searches is the id returned in the typeahead search, for example a user id when searching for a user in the system.

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:

Search Criteria Types

Search Criteria Types are specified using Ids, and are included in the body as "searchCriteriasType"

These are the search criteria types and their Ids:

Disposals

The following fields can be searched for disposals:

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

TEXTFIELD SEARCHES

Notes is the only field which can be searched using a text search.

We are searching the notes field where the name contains "august".

This value is added in the "model" property of the request body

Here is our POST body:

POST https://securelb.trackerproducts.com/api/disposals/search


{

"tags": [],

"IsSearchingInSublocations": false,

"DynamicFields": [],

"StaticFields": [

{

"name": "ITEMS.VIEW.NOTES",

"typeId": 0,

"fieldName": "Notes",

"searchCriterias": [],

"searchCriteria": 4,

"model": "august"

},

{

"name": "SEARCH.OFFICE_SELECTION",

"typeId": 7,

"fieldName": "OfficeSelection",

"searchCriteriasType": 5,

"dropdownEntities": {

"entity": "offices"

},

"searchCriterias": [],

"selectedOffices": [],

"model": [],

"searchCriteria": 0

}

],

"officeIds": [

1

],

"orderBy": "Date",

"orderByAsc": false,

"PageSize": 25,

"PageNumber": 1 }


Which returns the following result:


{

"count": 1,

"data": [

{

"id": 35261,

"notes": "August Auction",

"date": "2018-08-29T20:03:26.04358+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

}

]

}


DATE SEARCHES

The following date search is available for disposals: (field name is in parentheses)

Here is an example of a Disposal Date field search

We are searching a disposal date between the dates 08/01/2018 and 08/29/2018.

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 "2018-08-01T04:00:00.000Z"

Here is our POST body:

POST https://securelb.trackerproducts.com/api/disposals/search


{

"tags": [


],

"IsSearchingInSublocations": false,

"DynamicFields": [


],

"StaticFields": [

{

"name": "DISPOSAL.DISPOSE_DATE",

"typeId": 2,

"fieldName": "Date",

"searchCriteriasType": 2,

"searchCriterias": [],

"searchCriteria": 8,

"toDate": "2018-08-29T04:00:00.000Z",

"model": "2018-08-01T04:00:00.000Z"

},

{

"name": "SEARCH.OFFICE_SELECTION",

"typeId": 7,

"fieldName": "OfficeSelection",

"searchCriteriasType": 5,

"dropdownEntities": {

"entity": "offices"

},

"searchCriterias": [],

"selectedOffices": [],

"model": [],

"searchCriteria": 0

}

],

"officeIds": [

1

],

"orderBy": "Date",

"orderByAsc": false,

"PageSize": 25,

"peopleIds": [


],

"PageNumber": 1

}


This search yields the following result:


{

"count": 2,

"data": [

{

"id": 35261,

"notes": "August Auction",

"date": "2018-08-29T20:03:26.04358+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

},

{

"id": 35260,

"notes": "this a test",

"date": "2018-08-29T19:15:09.1236372+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

}

]

}


Dropdown Fields

There is one available drop down field search available for disposals:

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

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


Here is a sample of returned data from this endpoint:

[

{

"id": 12,

"name": "Accidental Item Entry",

"organizations": []

},

{

"id": 4,

"name": "Auctioned",

"organizations": []

},

{

"id": 26,

"name": "County Treasurer",

"organizations": []

},

{

"id": 2,

"name": "Destroyed",

"organizations": []

},

{

"id": 34,

"name": "Drug Destroy",

"organizations": []

}

]


And here is a search request for disposals with a disposal method "Auctioned" which is provided by id in the model field.

POST https://securelb.trackerproducts.com/api/disposals/search


{

"tags": [],

"IsSearchingInSublocations": false,

"DynamicFields": [],

"StaticFields": [

{

"name": "ITEMS.VIEW.DISPOSAL_METHOD",

"typeId": 3,

"fieldName": "MethodId",

"searchCriteriasType": 1,

"dropdownEntities": {

"entity": "disposalmethods",

"options": {

"belongToOrganization": true

}

},

"searchCriterias": [],

"dropdownValues": [],

"searchCriteria": 0,

"model": 4

},

{

"name": "SEARCH.OFFICE_SELECTION",

"typeId": 7,

"fieldName": "OfficeSelection",

"searchCriteriasType": 5,

"dropdownEntities": {

"entity": "offices"

},

"searchCriterias": [],

"selectedOffices": [],

"model": [],

"searchCriteria": 0

}

],

"officeIds": [

1

],

"orderBy": "Date",

"orderByAsc": false,

"PageSize": 25,

"peopleIds": [],

"PageNumber": 1

}


Here is a sample of the returned data:

POST https://securelb.trackerproducts.com/api/disposals/search


{

"count": 19,

"data": [

{

"id": 35261,

"notes": "August Auction",

"date": "2018-08-29T20:03:26.04358+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

},

{

"id": 35260,

"notes": "this a test",

"date": "2018-08-29T19:15:09.1236372+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

},


Disposed By Search

The disposed by field can also be searched for disposals.

In the UI the disposed by field is a type ahead search for users.

You can see a detailed look of user searches here:

User Administration 



To search disposals by the Disposed By field, you will supply the user id in the *model* for a boolean type of search.

Here is an example for searching for disposals made by user with id of 1:

(Note I am also limiting the search to disposals made in the last 10 days)


{

"tags": [],

"IsSearchingInSublocations": false,

"DynamicFields": [],

"StaticFields": [

{

"name": "ITEMS.DISPOSAL.DISPOSED_BY",

"typeId": 5,

"fieldName": "DisposedById",

"searchCriteriasType": 1,

"searchCriterias": [],

"searchCriteria": 0,

"isCurrentUserSelected": false,

"model": 1

},

{

"name": "DISPOSAL.DISPOSE_DATE",

"typeId": 2,

"fieldName": "Date",

"searchCriteriasType": 2,

"searchCriterias": [],

"searchCriteria": 12,

"model": "10",

"toDate": "2018-08-30T04:00:00.000Z"

},

{

"name": "SEARCH.OFFICE_SELECTION",

"typeId": 7,

"fieldName": "OfficeSelection",

"searchCriteriasType": 5,

"dropdownEntities": {

"entity": "offices"

},

"searchCriterias": [],

"selectedOffices": [],

"model": [],

"searchCriteria": 0

}

],

"officeIds": [

1

],

"orderBy": "Date",

"orderByAsc": false,

"PageSize": 25,

"peopleIds": [

],

"PageNumber": 1,

"SavedSearchEntities": [


]

}


This search brings back the following result:


{

"count": 2,

"data": [

{

"id": 35261,

"notes": "August Auction",

"date": "2018-08-29T20:03:26.04358+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

},

{

"id": 35260,

"notes": "this a test",

"date": "2018-08-29T19:15:09.1236372+00:00",

"methodId": 4,

"disposedById": 1,

"itemsCount": 1,

"officeId": 1,

"isForbidden": false

}

]

}


Disposed Items

It can also be useful to know the items which were disposed in a particular disposal transaction.

This can be accomplished by providing the disposal id to the following endpoint:

GET https://securelb.trackerproducts.com/api/disposals/{id}/items


This will return the item object for all of the items in the transaction.

The {id} in the url can be found in any of the returned data objects outlined above.

Here is a request for the items disposed in the disposal transaction with id of 35261.

GET https://securelb.trackerproducts.com/api/disposals/35261/items


This returns the one item from the transaction:


[

{

"sequentialCaseId": "2",

"sequentialCaseIdNested": {

"section": 2,

"nested": null

},

"barcode": "b271ec20-bccf-40d3-ae86-d9bbb5acce4e",

"description": "hat",

"recoveryDate": "2018-08-29T04:00:00Z",

"recoveryLocation": "Newport, KY, USA",

"active": true,

"locationId": null,

"location": null,

"lastLocationId": 45985,

"lastLocation": "Drawer 1",

"statusId": 3,

"status": "Disposed",

"categoryId": 6,

"category": "Clothing",

"custodyReasonId": 5,

"custodyReason": "Evidence",

"recoveredById": 1,

"recoveredBy": "Jack 3176D103FF Sparrow",

"submittedById": 1,

"submittedBy": "Jack 3176D103FF Sparrow",

"custodianId": null,

"custodian": null,

"currentOfficeId": 1,

"primaryCaseId": 2933715,

"primaryCaseNumber": "2018-0829-01",

"primaryCaseOfficer": "Jack 3176D103FF Sparrow",

"isPrimaryCaseRestricted": false,

"make": null,

"model": null,

"serialNumber": null,

"creatingOrgId": 1,

"dateCreated": "2018-08-29T20:03:04.551Z",

"loaningOrgId": null,

"incomingOrgId": null,

"sequentialOrgId": 151094,

"cases": [

2933715

],

"caseModels": [],

"media": null,

"mediaAmount": 0,

"rootMediaFolderId": 173921,

"formData": [

{

"id": "5b86fbf8185c8a41b0806309",

"active": true,

"entityId": 4935705,

"formId": 906,

"formName": "Test Custom Dtaa",

"dateFields": null,

"data": "{}",

"organizationId": 1,

"officeId": 1,

"visibilityId": 0

}

],

"formDataAmount": 1,

"notes": [],

"notesAmount": 0,

"tags": [],

"tagsAmount": 0,

"barcodes": [],

"barcodesAmount": 0,

"id": 4935705,

"sqlId": 0,

"people": null,

"peopleIds": [],

"peopleNames": null,

"parentItemId": null,

"parentItemDescription": null,

"parentSequentialOrgId": null,

"childItems": [],

"childItemsAmount": 0,

"tasks": [],

"tasksAmount": 0,

"historiesAmount": 0,

"isForbidden": false

}

]


Item Transaction Searches

This new search is currently in development.


GET https://securelb.trackerproducts.com/api/disposals/getItemDisposals/{id}

"id" is the item id you would like disposals for



With this endpoint, you can search for disposals by providing an item id. Disposals will be returned in the following format, ordered by descending date:

{

"count": 3,

"disposal": [

{

"id": 35263,

"date": "2018-10-19T13:44:45.8214334+00:00",

"disposedById": 1,

"methodId": 2,

"notes": "dispose test",

"organizationId": 1,

"officeId": 1,

"count": 1

},

{

"id": 35262,

"date": "2018-10-17T21:25:20.9744003+00:00",

"disposedById": 1,

"methodId": 4,

"notes": "2nd disposal",

"organizationId": 1,

"officeId": 1,

"count": 1

},

{

"id": 35260,

"date": "2018-08-29T19:15:09.1236372+00:00",

"disposedById": 1,

"methodId": 4,

"notes": "this a test",

"organizationId": 1,

"officeId": 1,

"count": 1

}

]

}


To see a list of disposal methods, as referenced above in methodId, use the following endpoint:

GET https://securelb.trackerproducts.com/api/disposalMethods



To find a specific disposal method by id, you can use the following endpoint:

GET https://securelb.trackerproducts.com/api/disposalMethods{id}



To find the user referenced in a disposal transaction, as referenced by "disposedById" above, use the following endpoint:

GET https://securelb.trackerproducts.com/api/users/{id}



Similar searches can be made for checkins, checkouts, transfers, and moves with the following GET requests:

GET https://securelb.trackerproducts.com/api/checkins/getItemCheckIns/{id}

"id" is the item id you would like checkins for


GET https://securelb.trackerproducts.com/api/checkins/getItemCheckOuts/{id}

"id" is the item id you would like checkouts for


GET https://securelb.trackerproducts.com/api/checkins/getItemTransfers{id}

"id" is the item id you would like transfers for


GET https://securelb.trackerproducts.com/api/moves/getItemMoves/{id}

"id" is the item id you would like moves for