API - Item Edit

Please Note - as of v100:

PrimaryCaseOfficerId(long data type) is now PrimaryCaseOfficerIds (array of long data type)

PrimaryCaseOfficer(string data type) is now PrimaryCaseOfficers(array of string data type)

First, we will do a get request to retrieve the item object. Note the item id is provided in the url (in this example the number 5351907)

GET

http://securelb.trackerproducts.com/api/items/5351907


This will return a json object for the item:


{

"sequentialCaseId": "1",

"sequentialCaseIdNested": {

"section": 1,

"nested": null

},

"barcode": "0ea938ac-664c-4dfa-96cf-26b6aed6725e",

"description": "test",

"recoveryDate": "2020-11-27T17:01:00Z",

"recoveryLocation": "Norwood, OH, USA",

"recoveryLocationLatitude": null,

"recoveryLocationLongitude": null,

"active": true,

"locationId": 1,

"location": "root",

"fullLocation": null,

"lastLocationId": 1,

"lastLocation": "root",

"statusId": 1,

"status": "Checked In",

"categoryId": 195,

"category": "Alcohol",

"custodyReasonId": 57,

"custodyReason": "Evidence",

"recoveredById": 0,

"recoveredBy": "",

"submittedById": 1,

"submittedBy": "Jack 3176D103FF Sparrow",

"custodianId": null,

"custodian": null,

"currentOfficeId": 1,

"currentOfficeName": "1 Office, LLC",

"primaryCaseId": 2934782,

"primaryCaseNumber": "2020-1127-01",

"primaryCaseOfficerIds": [ 1 ],

"primaryCaseOfficers": [ "Tracker Administrator" ],

"primaryCaseOffenseTypeId": 74,

"primaryCaseOffenseType": "Alcohol Related",

"isPrimaryCaseRestricted": false,

"make": null,

"model": null,

"serialNumber": null,

"creatingOrgId": 1,

"dateCreated": "2020-11-27T17:01:12.895Z",

"loaningOrgId": null,

"incomingOrgId": null,

"sequentialOrgId": 163139,

"cases": [

2934782

],

"caseModels": [],

"media": null,

"mediaAmount": 1,

"rootMediaFolderId": 294800,

"formData": null,

"formDataAmount": 0,

"notes": [],

"notesAmount": 0,

"tags": [],

"tagsAmount": 0,

"barcodes": [],

"barcodesAmount": 0,

"id": 5351907,

"sqlId": 0,

"people": null,

"peopleIds": [],

"peopleNames": null,

"peopleGuids": null,

"parentItemId": null,

"parentItemDescription": null,

"parentSequentialOrgId": null,

"childItems": [],

"childItemsAmount": 0,

"tasks": [],

"tasksAmount": 0,

"historiesAmount": 0,

"checkoutReasonId": null,

"checkoutTakenById": null,

"checkedOutById": null,

"checkoutExpectedReturnDate": null,

"checkoutNotes": null,

"checkoutSignature": null,

"isNewItemCheckout": false,

"isForbidden": false

}




2. Now you can use the returned item object, make any changes to the item, and then submit update to the following endpoint using the item id in a PUT request.

Note - formData in the above GET is null, for the update to process correctly, your request should have an empty array.


PUT

http://securelb.trackerproducts.com/api/items/5351907

Here is the body of the request:


{

"sequentialCaseId": "1",

"sequentialCaseIdNested": {

"section": 1,

"nested": null

},

"barcode": "0ea938ac-664c-4dfa-96cf-26b6aed6725e",

"description": "test - update of description",

"recoveryDate": "2020-11-27T17:01:00Z",

"recoveryLocation": "Norwood, OH, USA",

"recoveryLocationLatitude": null,

"recoveryLocationLongitude": null,

"active": true,

"locationId": 1,

"location": "root",

"fullLocation": null,

"lastLocationId": 1,

"lastLocation": "root",

"statusId": 1,

"status": "Checked In",

"categoryId": 195,

"category": "Alcohol",

"custodyReasonId": 57,

"custodyReason": "Evidence",

"recoveredById": 0,

"recoveredBy": "",

"submittedById": 1,

"submittedBy": "Jack 3176D103FF Sparrow",

"custodianId": null,

"custodian": null,

"currentOfficeId": 1,

"currentOfficeName": "1 Office, LLC",

"primaryCaseId": 2934782,

"primaryCaseNumber": "2020-1127-01",

"primaryCaseOfficerIds": [ 1 ],

"primaryCaseOfficers": [ "Tracker Administrator" ],

"primaryCaseOffenseTypeId": 74,

"primaryCaseOffenseType": "Alcohol Related",

"isPrimaryCaseRestricted": false,

"make": null,

"model": null,

"serialNumber": null,

"creatingOrgId": 1,

"dateCreated": "2020-11-27T17:01:12.895Z",

"loaningOrgId": null,

"incomingOrgId": null,

"sequentialOrgId": 163139,

"cases": [

2934782

],

"caseModels": [],

"media": null,

"mediaAmount": 1,

"rootMediaFolderId": 294800,

"formData": null,

"formDataAmount": 0,

"notes": [],

"notesAmount": 0,

"tags": [],

"tagsAmount": 0,

"barcodes": [],

"barcodesAmount": 0,

"id": 5351907,

"sqlId": 0,

"people": null,

"peopleIds": [],

"peopleNames": null,

"peopleGuids": null,

"parentItemId": null,

"parentItemDescription": null,

"parentSequentialOrgId": null,

"childItems": [],

"childItemsAmount": 0,

"tasks": [],

"tasksAmount": 0,

"historiesAmount": 0,

"checkoutReasonId": null,

"checkoutTakenById": null,

"checkedOutById": null,

"checkoutExpectedReturnDate": null,

"checkoutNotes": null,

"checkoutSignature": null,

"isNewItemCheckout": false,

"isForbidden": false

}




A successful update will return a status code 200


Item update to add custom form data


1. you must retrieve custom form data.


Here is the endpoint to retrieve available custom forms:

Note there are 4 options for retrieving forms - All, Cases, Items, People

(see the request header below)

GET

http://securelb.trackerproducts.com/api/forms?formType=Items


Among the returned results I have the following form:

},

{

"id": 839,

"name": "Send Item to Lab (Sys Template)",

"schema": "{\"fields\":

[{\"type\":\"checkbox\",\"name\":\"field7289\",\"nolabel\":true,\"displayName\":\"Send Item to Lab\",\"$$hashKey\":\"object:2822\",\"$_invalid\":false,\"$_displayProperties\":fals\e}],\"$_invalid\":false}",

"organizationId": 1,

"modelTypeId": 5,

"locked": false,

"isSharedForm": true,

"isActive": true,

"order": 38

},

{



The below request will add "Send Item To Lab" form to the item

An example PUT request will look like the following:


Note- within formData.data double quotes are escaped with a backward slash

PUT

http://securelb.trackerproducts.com/api/items/5351907

Here is the body of the request:


{

"sequentialCaseId": "1",

"sequentialCaseIdNested": {

"section": 1,

"nested": null

},

"barcode": "0ea938ac-664c-4dfa-96cf-26b6aed6725e",

"description": "test - update of description",

"recoveryDate": "2020-11-27T17:01:00Z",

"recoveryLocation": "Norwood, OH, USA",

"recoveryLocationLatitude": null,

"recoveryLocationLongitude": null,

"active": true,

"locationId": 1,

"location": "root",

"fullLocation": null,

"lastLocationId": 1,

"lastLocation": "root",

"statusId": 1,

"status": "Checked In",

"categoryId": 195,

"category": "Alcohol",

"custodyReasonId": 57,

"custodyReason": "Evidence",

"recoveredById": 0,

"recoveredBy": "",

"submittedById": 1,

"submittedBy": "Jack 3176D103FF Sparrow",

"custodianId": null,

"custodian": null,

"currentOfficeId": 1,

"currentOfficeName": "1 Office, LLC",

"primaryCaseId": 2934782,

"primaryCaseNumber": "2020-1127-01",

"primaryCaseOfficerIds": [ 1 ],

"primaryCaseOfficers": [ "Tracker Administrator" ],

"primaryCaseOffenseTypeId": 74,

"primaryCaseOffenseType": "Alcohol Related",

"isPrimaryCaseRestricted": false,

"make": null,

"model": null,

"serialNumber": null,

"creatingOrgId": 1,

"dateCreated": "2020-11-27T17:01:12.895Z",

"loaningOrgId": null,

"incomingOrgId": null,

"sequentialOrgId": 163139,

"cases": [

2934782

],

"caseModels": [],

"media": null,

"mediaAmount": 1,

"rootMediaFolderId": 294800,

"formData": [

{

"formId": 839,

"formName": "Send Item to Lab",

"data": "{\"field7289\":true}",

"entityId": "5349399",

"dateFields": [ ]

}

],

"formDataAmount": 0,

"notes": [],

"notesAmount": 0,

"tags": [],

"tagsAmount": 0,

"barcodes": [],

"barcodesAmount": 0,

"id": 5351907,

"sqlId": 0,

"people": null,

"peopleIds": [],

"peopleNames": null,

"peopleGuids": null,

"parentItemId": null,

"parentItemDescription": null,

"parentSequentialOrgId": null,

"childItems": [],

"childItemsAmount": 0,

"tasks": [],

"tasksAmount": 0,

"historiesAmount": 0,

"checkoutReasonId": null,

"checkoutTakenById": null,

"checkedOutById": null,

"checkoutExpectedReturnDate": null,

"checkoutNotes": null,

"checkoutSignature": null,

"isNewItemCheckout": false,

"isForbidden": false

}