Search Service API

Clearance Developer Guide

Content type
Guides > Developer guides
Product line
Clearance
Language
English
Applies to
Genetec Clearance

The Search Service API is an index of all the entities contained in a single tenant. With the Search Service API you can search all the different entities in Genetec Clearance™: Cases, Evidences, Users, Group, Devices. You can also perform geo-spatial searches that return results within a bounding box.

Search Service interactive documentation

See:

Examples of a text search:

Here is an example showing how to find all the Case or Evidence containing the word "Smith".

curl -X POST --header 'Content-Type: application/json-patch+json' --header 'Accept: application/json' --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjIwMTcwOTA2LWNsZWFyYW5jZS1zaWduaW5nLXByb2QtYSIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1MjEwNTQ2NDYsImV4cCI6MTUyMTA2OTA0NiwiaXNzIjoiaHR0cHM6Ly9jbGVhcmFuY2UtYS1zdHMuZ2VuZXRlY2Nsb3VkLmNvbSIsImF1ZCI6Imh0dHBzOi8vY2xlYXJhbmNlLWEtc3RzLmdlbmV0ZWNjbG91ZC5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoieW91ci1jbGllbnQtaWQiLCJzdWIiOiJqZG95b25AZ2VuZXRlYy5jb20iLCJhdXRoX3RpbWUiOjE1MjEwNTQ2NDYsImlkcCI6ImxvY2FsIiwibmFtZSI6Impkb3lvbkBnZW5ldGVjLmNvbSIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJqZG95b25AZ2VuZXRlYy5jb20iLCJodHRwOi8vc2NoZW1hcy5nZW5ldGVjLmNvbS93cy8yMDE2LzAzL2lkZW50aXR5L2NsYWltcy9wcmltYXJ5a2lkIjoidXJuOnVzZXI6amRveW9uZGVtbzpqZG95b25AZ2VuZXRlYy5jb206MyIsImh0dHA6Ly9zY2hlbWFzLmdlbmV0ZWMuY29tL3dzLzIwMTYvMDMvaWRlbnRpdHkvY2xhaW1zL3ByaW1hcnlpZCI6IjMiL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bA' -d '{ \ 
   "Types": [ \ 
     "Case", \ 
     "Evidence" \ 
   ], \ 
   "Query": "smith", \ 
   "Skip": 0, \ 
   "Take": 100 \ 
 }' 'https://dems-proda-api.clearance.network/searchservice/api/v1/tenant/{TenantID}/search'

This example uses the North American instance of Clearance.

HTTP RESPONSE:

{
  "NumResults": 1,
  "Results": [
    {
      "EntityType": "case",
      "CaseId": "276",
      "CategoryId": null,
      "Created": "2018-02-17T18:44:12.126Z",
      "CreatedBy": "someone@genetec.com",
      "DepartmentId": "administrators",
      "Description": "",
      "ExternalReferenceId1": "",
      "ExternalReferenceId2": "",
      "LastModified": "2018-03-09T20:52:06.049Z",
      "LastModifiedBy": "someone@genetec.com",
      "Location": null,
      "LocationText": null,
      "LocationWKT": null,
      "OccurredOn": null,
      "EndedOn": null,
      "State": "Active",
      "Title": "John Smith",
      "LifecycleState": "Normal",
      "DeletedBy": null,
      "DeletedOnUtc": null,
      "EvidencesCount": 1,
      "CorrelatedEvidencesCount": null,
      "EntityId": "276",
      "EntityOrdinal": 11,
      "EntityTenantId": "tenant123"
    }
  ]
}

Examples of a geo-spatial search:

Here is the body of the POST method for searching all the evidences around New-York City.

Note the "Query": "*" to return all the evidences.

{
  "Query": "*",
  "Types": [ "evidence" ],
  "Skip": 0,
  "Take": 1000,
  "Location": {
    "Distance": 21.371249884144405,
    "Latitude": 40.787990717115406,
    "Longitude": -73.91440084614261
  }
}

Paged results with a large number of hits

The response returned by the search service is paged because it can return millions of results. In the Body of the POST, you must specify the "Skip" and "Take" parameters to specify the index where to start (Skip) and the number of results to return (Take).

{
  "Types": [
    "Case",
    "Evidence"
  ],
  "Query": "smith",
  "Skip": 0,
  "Take": 100
}