API Example Create Case

v100 has a change in the case model:

CaseOfficerId field is now CaseOfficerIds and accepts an array of user ids

API URL

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

Fields used in Post

Example JSON Submit


{

        "caseOfficerIds": [ 12659 ],

       "offenseTypeId":1,

       "caseNumber":"20171129D",

       "offenseDescription":"Test Offense Description",

       "offenseLocation":"123 My Address New York, Ny 20012"

       "offenseDate":"2017-11-29 13:25:00.000", (24 hour time format or 12 hour time format - If no time is supplied it will default to system server time)

       "active":true,

       "formData":[],

       "tags":[],

}

Postman Header Example

Postman JSON Body Example

Creating Case With Custom Form Data


Note that the double quote must be escaped with a forward slash

A case can also be created with custom data. Note that the entityId field will be 0 for a new case (this value is the case id which the system will assign after the case is created).

Here is my json for adding a case with the custom form data:

{

"offenseDate": "2020-02-13T05:00:00.000Z",

"active": true,

"offenseDescription": "Burning Down The House",

"offenseTypeId": 2,

"formData": [

{

"formId": 1184,

"formName": "Test Form Cases",

"data": "{\"field2426\":{\"1\":true},

\"field2428\":\"2\",

\"field2430\":\"3\",

\"field2435\":\"3\",

\"field2424\":\"This is a text field\",

\"field2432\":\"2020-02-13T05:00:00.000Z\"}",

"visibilityId": 1,

"dateFields": [

"field2432"

]

}

],

"tags": [


],

"reviewDateNotes": "",

"checkInProgress": false,

"caseNumber": "2020-0213-01",

"reviewDate": "2021-02-12T19:27:04.230Z",

"caseOfficerIds": [ 12659 ]

"offenseLocation": "Newport, KY, USA"

}

Possible Error Scenarios


In this section, we will look at errors returned during a case POST.

Auto Disposition Error


This error occurs when auto disposition is turned on for an organization and the organization does not have auto disposition settings for all offense types.

Here is an example:

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


{

"active": true,

"offenseDescription": "test",

"offenseTypeId": 178,

"formData": [ ],

"tags": [ ],

"reviewDateNotes": "",

"checkInProgress": false,

"caseNumber": "2020-0325-02",

"reviewDate": "2047-09-26T14:08:21.372Z",

"caseOfficerIds": [ 12659 ],

"offenseLocation": "Newport, KY, USA"

}

Above, I am attemping to POST a case with an offense type of Bomb Threat

The return message from the request looks like this:

{

"autoDispoErrors": [

"Auto Disposition Settings are not found for Bomb Threat"

]

}



This message is the result of missing auto disposition settings for the offense type, Bomb Threat.


To resolve, first get the auto disposition settings for the organization.

GET https://{api url}/api/autoDisposition/settings/


{

"isAutoDispositionOn": true,

"officeAutoDispositionReviewers": [

{

"officeId": 1,

"officeName": "1 Office, LLC",

"generalTaskFromUserId": 1,

"generalTaskFromUserGroupId": null,

\ "isDefault": true,

"isGeneralTaskFromUser": true

},

{

"officeId": 175,

"officeName": "175 Office",

"generalTaskFromUserId": null,

"generalTaskFromUserGroupId": 76,

"isDefault": false,

"isGeneralTaskFromUser": false

}

],

"settings": [

{

"id": 1,

"active": true,

"daysToFollowUp": 1000,

"organizationId": 1,

"organization": null,

"offenseTypeId": 1,

"offenseType": {

"organizationOffenseTypeFollowUpDays": null,

"id": 1,

"name": "Other",

"active": true,

"offenseTypeForms": null,

"organizations": [],

"autoDispositionSettings": [],

"customDropdownCategoryId": 1,

"customDropdownCategory": null

}

},

{

"id": 2,

"active": true,

"daysToFollowUp": 1000,

"organizationId": 1,

"organization": null,

"offenseTypeId": 2,

"offenseType": {

"organizationOffenseTypeFollowUpDays": null,

"id": 2,

"name": "Arson",

"active": true,

"offenseTypeForms": null,

"organizations": [],

"autoDispositionSettings": [],

"customDropdownCategoryId": 1,

"customDropdownCategory": null

}

},

{

"id": 3,

"active": true,

"daysToFollowUp": 1000,

"organizationId": 1,

"organization": null,

"offenseTypeId": 3,

"offenseType": {

"organizationOffenseTypeFollowUpDays": null,

"id": 3,

"name": "Assault",

"active": true,

"offenseTypeForms": null,

"organizations": [],

"autoDispositionSettings": [],

"customDropdownCategoryId": 1,

"customDropdownCategory": null

}

},

{

"id": 0,

"active": false,

"daysToFollowUp": 0,

"organizationId": 0,

"organization": null,

"offenseTypeId": 178,

"offenseType": {

"organizationOffenseTypeFollowUpDays": null,

"id": 178,

"name": "Bomb Threat",

"active": true,

"offenseTypeForms": null,

"organizations": [],

"autoDispositionSettings": [],

"customDropdownCategoryId": 1,

"customDropdownCategory": null

}

},



The response is rather long - I have abbreviated to include the pertinent information. Note that for offense type Bomb Threat id is 0, days to follow up is 0, organizationId is 0. We need to add settings for this offense type.

To accomplish this, the api user token must belong to a user with orgAdmin permissions.

PUT https://{api url}/api/autoDisposition/settings/

{

"isAutoDispositionOn": true,

"officeAutoDispositionReviewers": [

{

"officeId": 1,

"officeName": "1 Office, LLC",

"generalTaskFromUserId": 1,

"generalTaskFromUserGroupId": null,

\ "isDefault": true,

"isGeneralTaskFromUser": true

},

{

"officeId": 175,

"officeName": "175 Office",

"generalTaskFromUserId": null,

"generalTaskFromUserGroupId": 76,

"isDefault": false,

"isGeneralTaskFromUser": false

}

], "settings": [

{

"id": 0,

"active": false,

"daysToFollowUp": 100,

"organizationId": 1,

"organization": null,

"offenseTypeId": 178,

"offenseType": {

"organizationOffenseTypeFollowUpDays": null,

"id": 178,

"name": "Bomb Threat",

"active": true,

"offenseTypeForms": null,

"organizations": [],

"autoDispositionSettings": [],

"customDropdownCategoryId": 1,

"customDropdownCategory": null

}

}

],

"listPermissionGroupIds": [

1,68,69,1387,1388, 1389

],

"createPermissionGroupIds": [

1,68,69,1387,1389

],

"updatePermissionGroupIds": [

43,68,69,1387,1389

]

}



Some Notes: