REST API for searching (v2)
This page describes VERSION 2 of the searching REST API, available since Claromentis 8.6.
Base URL for all REST calls for searching is /api/search/v2/
Simple keywords search
GET /api/search/v2/simple?q=:keywords
GET /api/search/v2/simple?created_from=:from_date&created_to=:to_date
Main CGI-style search parameters are:
- q=:keywords - Search keywords
- created_from=:from_date - Filter/search objects by creation date
- created_to=:to_date - Filter/search objects by creation date
- modified_from=:modified_from_date - Filter/search objects by modification date
- modified_to=:modified_to_date - Filter/search objects by modification date
Multiple parameters can be used, but at least one must exist otherwise a 400 Bad Request response will be returned.
Dates and times in the parameters list can have one of the following formats:
- 8-digit date in form of YYYYMMDD
- 14-digit date and time in form of YYYYMMDDHHmmss. Note, this time is in UTC but not the system or user's timezone.
- string in "long_date" format as specified in the main Claromentis config file. Typically it's YYYY-MM-DD or DD-MM-YYYY
Optional CGI-style parameters are:
- limit=:limit_number - Number if results to return. Default is 20
- offset=:offset_number - Return search results starting from the specified item (counting is 0-based, so the default second page starts from result number 20)
- object_type=:obj_list - Comma separated list of object types to search
Search results are never returned all at once. Instead paged output is used. The result contains the reference to the next page, if it exists.
A failed search result looks like this:
{
"success" : false,
"error_message" : "Error description"
}
A successful search result looks like this:
{
"success" : true,
"results" : {
"data": [
// array of search result items (see below)
],
"paging": {
"offset": 0,
"limit": 20,
"next": "http://server.name/api/search/v2/simple?q=keywords&offset=20&limit=20"
}
}
}
Examples of search result items, the data returned should be self-explanatory:
// folder
{
"type" : "folder",
"id" : 92,
"parent_id" : 89,
"realname" : "test",
"realname2" : null,
"creator" : {
"id" : 12,
"name" : "Aleksandr Polyanskikh"
},
"date_created" : {
"date_str" : "13-05-2011 18:13 ICT",
"timezone" : "Asia/Novosibirsk",
"date" : "20110513111311"
},
"date_last_modified" : {
"date_str" : "13-05-2011 18:13 ICT",
"timezone" : "Asia/Novosibirsk",
"date" : "20110513111311"
},
"description" : "sample folder"
}
// document
{
"type" : "document",
"id" : 4744,
"doc_id" : 4744,
"version_num" : 1,
"parent_id" : 788,
"realname" : "LDAP and NTLM(5).doc",
"realname2" : "LDAP and NTLM(5).doc",
"creator" : {
"id" : 12,
"name" : "Aleksandr Polyanskikh"
},
"date_created" : {
"date_str" : "04-10-2011 16:05 ICT",
"timezone" : "Asia/Novosibirsk",
"date" : "20111004090520"
},
"date_last_modified" : {
"date_str" : "04-10-2011 16:05 ICT",
"timezone" : "Asia/Novosibirsk",
"date" : "20111004090520"
},
"description" : null
}
Objects types
Supported objects types returned by search are:
- document
- folder
- forum
- pub_folder
- pub_page
- ic_issue
- user
type | description |
---|---|
document | A document in the documents application |
folder | A folder in the documents application |
forum | A post in the forum application |
pub_folder | A folder in the publish application |
pup_page | A page in the publish application |
ic_issue | An issue in the infocapture application |
user | A user account in Claromentis |
Modules may register their own types to be searchable, and many do.