Search with criteria

Table 1. Search with criteria API
HTTP verb URL Request parameters
POST /cmod-rest/v1/hits/{folderName} Content Manager OnDemand folder name

JSON request payload

The search with criteria API takes a URL encoded folder name and a JSON request payload consisting of an array of folder criteria. It returns, among other things, a hitList array that contains folder field values, the MIME type, and the document identifier that can be used with the Retrieve APIs to get a document from Content Manager OnDemand.

The search criteria information can be obtained from the Folder details API as a guideline for building the JSON request payload.

The search with criteria API uses AND-based logic for the search by default. For example, criteria1 AND criteria2 must be true in order to result in a match. OR-based logic can be used by specifying "orSearchCriteria" : "true" in the request payload. See Table 2.

The request payload consists of the following parameters formatted as JSON. See the Sample request following the table for an example.

Table 2. Request payload parameters for search with criteria API
Parameter name Type Description
criteria array Array of criteria objects
fieldname string Content Manager OnDemand field name
operator string One of the valid folder search operators. The valid operators for the search with criteria API are: "Equals", "Not Equal", "Less Than", "Less Than or Equal", "Greater Than", "Greater Than or Equal", "In", "Not In", "Like", "Not Like", "Between", and "Not Between".
values array At most two strings that specify what to search for.
sortLocation string One of the valid sort locations: "none" (default), "server", or "midtier". This parameter is optional.
orSearchCriteria string Set to "true" for search criteria to be ORed during a search. Setting to "false" (default) or omitting the parameter causes search criteria to be ANDed. This parameter is optional.
Note: Due to requirements imposed by the Content Manager OnDemand server, the date segment field is always ANDed with the rest of the search fields regardless of the orSearchCriteria value.

Sample request

POST /cmod-rest/v1/hits/Ledger%20Reports HTTP/1.1
usi-date: 2023-12-11T15:07:13Z
Authorization: CMODSharedKey odvttstl01-68yXERhn79KNry/oV7IY:XEbSy5SqDCsU9lpvgSzbNn6sraOrJUlqNE7z74eRQGI= 
Content-Type: application/json
Host: localhost
Content-Length: 290
            
{
  "criteria" : [ {
    "fieldName" : "Account Number",
    "operator" : "Like",
    "values" : [ "123456789" ]
  }, {
    "fieldName" : "Report Date",
    "operator" : "Between",
    "values" : [ "2020-02-03", "2023-08-03" ]
  } ],
  "sortLocation" : "none",
  "orSearchCriteria" : "true"  
}

Sample response

HTTP/1.1 200 OK
X-Powered-By: Servlet/4.0
X-Content-Type-Options: nosniff
Content-Type: application/json
Date: Mon, 11 Dec 2023 15:07:15 GMT
Correlation-Id: 4b8b942a-ab8c-4640-91c8-3a8099b287b8
Content-Language: en-US
Content-Length: 1498

{
  "folderName" : "Ledger Reports",
  "hitList" : [ {
    "docID" : "Y2gwMX57PQmCYdVv7r2+0rmQYlIUUziW4CFtCUnUUCVujCkxn2FpRk5HyHjIltAAicLzXiODLMDTGaBkcpsxJbftQO98M/qnbXo5nHHakdW+XSOMYue46pxozlbFzsh/wnOYSW1bJfJTUpH+MgFZibOOsC5eu9ktkMlklII1TRJu0=",
    "docType" : "U",
    "folderFields" : {
      "Account Name" : "BAXTER BAY",
      "File Name" : "REPORT.TXT",
      "Account Number" : "123456789",
      "Report Date" : "2023-08-03"
    },
    "link" : "http://localhost:9080/cmod-rest/v1/hits/Ledger%20Reports/Y2gwMX57PQmCYdVv7r2%2B0rmQYlIUUziW4CFtCUnUUCVujCkxn2FpRk5HyHjIltAAicLzXiODLMDTGaBkcpsxJbftQO98M%2FqnbXo5nHHakdW%2BXSOMYue46pxozlbFzsh%2FwnOYSW1bJfJTUpH%2BMgFZibOOsC5eu9ktkMlklII1TRJu0%3D",
    "mimeType" : "application/unknown"
  }, {
    "docID" : "Y2E8iGpfSA5TxgrcRg3CjhWWv+Ic+c5GqEltB6Nrl1T/VZv+g+cSb6r1x+uqAAgzX7t8Cj2C946aID9ZaLXBEIr9kj9KG4mds9ibiD33vj16yFu5VDA1O5pweN/u6n/KAdqLDih+kTyJ2uWuTZ5QzpPqgtg93fxwT1KhsXFct1vAM=",
    "docType" : "U",
    "folderFields" : {
      "Account Name" : "BAXTER BAY",
      "File Name" : "MONTHEND.TXT",
      "Account Number" : "123456789",
      "Report Date" : "2020-02-03"
    },
    "link" : "http://localhost:9080/cmod-rest/v1/hits/Ledger%20Reports/Y2E8iGpfSA5TxgrcRg3CjhWWv%2BIc%2Bc5GqEltB6Nrl1T%2FVZv%2Bg%2BcSb6r1x%2BuqAAgzX7t8Cj2C946aID9ZaLXBEIr9kj9KG4mds9ibiD33vj16yFu5VDA1O5pweN%2Fu6n%2FKAdqLDih%2BkTyJ2uWuTZ5QzpPqgtg93fxwT1KhsXFct1vAM%3D",
    "mimeType" : "application/unknown"
  } ],
  "totalHits" : "2"
}