Not logged in - Login

API Post Item

Fields Used In Post

  • All Fields in the JSON example are Text-based fields and not required unless listed in the following rows.
  • Description [Required text field]
  • Active [Required & Either True or False, generally checked in or out items are True and disposed items are False]
  • CategoryID [Required & See info below for getting a CategoryID]
  • RecoveredByID [Required & See info below for getting a RecoveredByID]
  • LocationID [Required & See info below for getting a LocationID]
  • RecoveryDate [Required, valid date]
  • Barcodes [Legacy barcodes used in Scan area]

{
"description":"shell casing",
"active":true,
"categoryId":2,
"recoveredById":1,
"recoveryLocation":"undefined",
"locationId":45986,
"recoveryDate":"2018-02-26T05:00:00.000Z",
"barcodes":[],
"formData":[],
"cases":[],
"tags":[],
"people":[
       {"id":1634853,
       "guid":"eaa90160-ac7f-45c7-9c93-f93b7318b2ad",
       "organizationId":1,
       "userId":null,
       "createDateTime":"2018-02-26T15:18:08.032Z",
       "updatedDateTime":null,
       "isDeleted":null,"businessName":"",
       "businessNameLC":"",
       "name":"Oscar Meyer",
       "nameLC":"oscar meyer",
       "firstName":"Oscar",
       "firstNameLC":"oscar",
       "middleName":"",
       "middleNameLC":null,
       "lastName":"Meyer",
       "lastNameLC":"meyer",
       "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":[],
       "formDataAmount":0,
       "notes":[],
       "notesAmount":0,
       "media":[],
       "mediaAmount":0,
       "rootMediaFolderId":123589,
       "displayedName":"Meyer, Oscar (N/A)",
       "defaultAddress":", , , , ",
       "isForbidden":false}
       ],
"primaryCaseId":2933619,
"custodyReasonId":5,
"peopleIds":[1634853]}


For the above, we will first need to get the following:
- Category Id
- Recovered By Id - this will be a user ID
- Storage Location Id
- custody reason Id
- people can have multiple persons - each one will have their own document (a
document is { })

Getting list of Categories

The following API endpoint will bring back all the item categories: https://securelb.trackerproducts.com/api/categories The results will be an array of all item categories:


[
{
"id": 138,
"name": "Accessory",
"organizations": [],
"categoryForms": null
},
{
"id": 31,
"name": "Alcohol",
"organizations": [],
"categoryForms": null
},
{
"id": 2,
"name": "Ammunition",
"organizations": [],
"categoryForms": null
},
{
"id": 143,
"name": "Apple Watch",
"organizations": [],
"categoryForms": null
},

This Id will be used to populate the CategoryId field for an item entry

Get Persons

The person recovered By Field will be populated with a user from the org. The first step would be to search for the user. We can do a search using the /api/users/typeahead endpoint

https://securelb.trackerproducts.com/api/users/typeahead?search=s

This search will bring back the following:


[
{
"id": 1,
"text": "Jack 3176D103FF Sparrow (jsparrow@trackerproducts.com)"
},
{
"id": 17663,
"text": "Mike Singleton (msingleton@trackerproducts.com)"
},
{
"id": 17664,
"text": "Victor Frankenstein (monster@gmail.com)"
}
]

For the Recovered By field we only need the Id of a person, so this search is sufficient

Custody Reasons

Here is the endpoint for getting all the custody reasons

https://securelb.trackerproducts.com/api/custodyreasons

This will bring back an array with all of the custody reasons. For the item entry - we will just need the Id of the custody reason.


[
{
"id": 40,
"name": "50 B",
"organizations": []
},
{
"id": 30,
"name": "Approved to Destroy",
"organizations": []
},
{
"id": 29,
"name": "Approved to Release",
"organizations": []
},
{
"id": 7,
"name": "Asset",
"organizations": []
},
{
"id": 42,
"name": "Business Continuity",
"organizations": []
},

Get Item Belongs To

In order to add a person to the Item Belongs To Field, the case must have a person attached to it.

To get the people that have been added to a case, we can use this endpoint:

https://securelb.trackerproducts.com/api/cases/2933619/peopleList

The number, 2933619, is the case Id that we wish to add an item into.

The result is an array of person documents:
[
{
"personId": 1634853,
"person": {
"id": 1634853,
"guid": "eaa90160-ac7f-45c7-9c93-f93b7318b2ad",
"organizationId": 1,
"userId": null,
"createDateTime": "2018-02-26T15:18:08.032Z",
"updatedDateTime": null,
"isDeleted": null,
"businessName": "",
"businessNameLC": "",
"name": "Oscar Meyer",
"nameLC": "oscar meyer",
"firstName": "Oscar",
"firstNameLC": "oscar",
"middleName": "",
"middleNameLC": null,
"lastName": "Meyer",
"lastNameLC": "meyer",
"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": [],
"formDataAmount": 0,
"notes": [],
"notesAmount": 0,
"media": [],
"mediaAmount": 0,
"rootMediaFolderId": 123589,
"displayedName": null,
"defaultAddress": ", , , , ",
"isForbidden": false
},
"personType": {
"id": 2,
"name": "Victim",
"active": true,
"organizations": null
},
"typeId": 2
}
]

This document would be used to populate the people array in the add item request.

Get Location ID

The last piece of information for a "basic" item entry to a case is the location ID.

The endpoint to receive a full list of an org's locations is : https://securelb.trackerproducts.com/api/locations/

This will return an array of all the org locations


[
{
"discrepancyReportSummaries": [],
"id": 1,
"name": "root",
"active": true,
"barcode": "d56225a3-2f27-4735-96b2-fa1d8c08b64a",
"officeId": 1,
"office": null,
"items": [],
"barcodes": null,
"groups": [
{
"users": null,
"userOfficePermissions": [],
"locations": [],
"tasks": null,
"id": 68,
"name": "Power User",
"description": "Power Users (All except Admin)",
"organizationId": 1,
"organization": null
}
],
"parentId": 33,
"parent": null,
"hasChildren": true,
"level": 3,
"fullPath": null,
"canStoreHere": true
},
{
"discrepancyReportSummaries": [],
"id": 5,
"name": "Room 1",
"active": true,
"barcode": "de70ff27-b93a-e511-a0e6-06e9f5d49c4d",
"officeId": 1,
"office": null,
"items": [],
"barcodes": null,
"groups": [],
"parentId": 1,
"parent": null,
"hasChildren": true,
"level": 4,
"fullPath": null,
"canStoreHere": false
},
{
"discrepancyReportSummaries": [],
"id": 6,
"name": "Room 3",
"active": true,
"barcode": "df70ff27-b93a-e511-a0e6-06e9f5d49c4d",
"officeId": 1,
"office": null,
"items": [],
"barcodes": null,
"groups": [],
"parentId": 1,
"parent": null,
"hasChildren": false,
"level": 4,
"fullPath": null,
"canStoreHere": false
},

For an item entry, the only data necessary is the LocationId. Note that the user must have permission to store an item in the location.

Also, an optional parameter for this request is a count of items stored in the location:

api/locations?itemsCount=true

Add Item With Custom Form Data

An item can be added that also contains custom form data. Here is an example of adding an item with a custom form: https://securelb.trackerproducts.com/api/items/


{
       "description":"Get away bike",
       "active":true,
       "categoryId":4,
       "recoveredById":1,
       "recoveryLocation":"undefined",
       "locationId":45986,
       "recoveryDate":"2018-02-28T05:00:00.000Z",
       "barcodes":[],
       "formData":[{
                            "formId":802,
                            "formName":"Bicycles",
                            "data":"{\"field3803\":{\"1\":true},
                                           \"field3801\":\"White\",
                                           \"field3805\":\"somepassword\"}",
                            "dateFields":[]
                            }],
       "cases":[],
       "tags":[],
       "people":[],
       "primaryCaseId":2933621,
       "custodyReasonId":5,
       "peopleIds":[]
}

Note the formData field with the formId 802. See below for getting the custom form by Id.

Getting Custom Form By Id

The following endpoint can be used for retrieving a custom form: https://securelb.trackerproducts.com/api/forms/802/

This will bring back the following form:
{
"id": 802,
"name": "Bicycles",
"schema": "{\"fields\":
                     [{
                      \"type\":\"text\",
                      \"name\":\"field3801\",
                      \"displayName\":\"Color of?\",
                      \"$$hashKey\":\"object:17107\",
                      \"$_displayProperties\":false,
                      \"$_invalid\":false,
                      \"validation\":{\"messages\":{}}
                      },
                      {
                      \"type\":\"checkboxlist\",
                      \"name\":\"field3803\",
                      \"displayName\":\"Checkbox List\",
                      \"options\":[{
                             \"value\":\"1\",
                                   \"text\":\"Option 1\",
                                   \"$$hashKey\":\"object:17120\"
                             },
                             {
                                    \"value\":\"2\",
                                     \"text\":\"Option 2\",
                                    \"$$hashKey\":\"object:17121\"
                                   },
                                   {
                                    \"value\":\"3\",
                                    \"text\":\"Option 3\",
                                    \"$$hashKey\":\"object:17122\"
                                   }],
                      \"value\":{},
                      \"$$hashKey\":\"object:17114\",
                      \"$_displayProperties\":true,
                      \"$_invalid\":false,
                      \"validation\":{\"messages\":{}}
                      },
                      {
                      \"type\":\"password\",
                      \"name\":\"field3805\",
                      \"displayName\":\"Password\",
                      \"$$hashKey\":\"object:17129\"
                      }]
              }",
              "organizationId": 1,
              "organization": null,
              "modelTypeId": 5,
              "modelType": null,
              "locked": false,
              "isSharedForm": false,
              "categoryForms": null,
              "offenseTypeForms": null
}