Sales Creatio, team edition
PDF
This documentation is valid for Creatio version 7.12.0. We recommend using the newest version of Creatio documentation.

API global search service description

The global search service includes the program interface (API), which is used for managing the ElasticSearch indexing and other Global Search Service parameters.

Service API includes the following actions:

AddSearch

DeleteSearch

GetServiceStatus

SaveIndexationConfigs

AddSite

SetSearchState

AddSearch

Creates an index with a unique name in ElasticSearch. Updates the site information in the local database (OnSite-db), saves the index name, and Id of the search service and the search status (Enabled). Returns a link to the global search index in ElasticSearch, which you need to save in the “Global search url address” system setting of the bpm'online application.

EndPoint/URL:  ServiceUrl/addsearch.

Request type: POST.

Parameters Body:

ApiKey – authorization key (specified in Web.config).

SiteName – website name.

Response:

status: “ok” / ”error”.

message: “http://{ElasticSearch URL}” / “{Error message}”.

code: 200/400.

Example of a call in Powershell:

$params = @{
"ApiKey"= "ApiKey";
"SiteName"="NameOfSite"
}
Invoke-WebRequest -Uri http://serviceUrl/addsearch -Method POST -Body
$params

DeleteSearch

Removes the global search index from ElasticSearch, deletes the directory with *.sql files, updates the information about the site in the local database (OnSite-db), deletes the index name, and Id of the search service, changes the search status to “Disabled”.

EndPoint/URL:  ServiceUrl/deletesearch.

Request type: POST.

Parameters Body:

ApiKey – authorization key (specified in Web.config).

SiteName – website name.

Response:

status: “ok” / ”error”.

message: “Global search deleted from site {Website name}” / “{Error name}”.

code: 200/400.

Example of a call in Powershell:

$params = @{
"ApiKey"= "ApiKey";
"SiteName"="NameOfSite"
}
Invoke-WebRequest -Uri http://serviceUrl/deletesearch -Method POST
-Body $params

GetSearchStat

Returns the following data: the website name and index name in ElasticSearch, index size in bytes, the date of last indexation, the status of the search (Enabled/Disabled), the list of indexed entities and their parameters. The information is collected from ElasticSearch and the local database (OnSite-db).

EndPoint/URL:  ServiceUrl/getsearchstat.

Request type: POST.

Parameters Body:

ApiKey – authorization key (specified in Web.config).

SiteName – website name.

Response:

globalSearchStats: the object that contains the status parameters. In case of an error, this object will be missing. The object has the following properties:

siteName – “{website name}”.

indexName – “{index name}”.

indexSize – “100500” (index size in bytes).

lastIndexingDate - the date of last indexation in the UTC format (or "0001-01-01T00: 00: 00.0000000” if indexing has not yet been done).

globalSearchState – global search status.

globalSearchIndexingEntities - list of all indexed website entities (the records from the GlobalSearchIndexingEntity table) in a JSON form.

status: “ok” / ”error”.

message: “Succeeded. Got global search stats for site {Website name}” / “{Error message}”.

code: 200/400.

Example of a call in Powershell:

$params = @{
"ApiKey"= "ApiKey";
"SiteName"="NameOfSite"
}
Invoke-WebRequest -Uri http://serviceUrl/getsearchstat -Method POST
-Body $params

GetServiceStatus

Returns “OK” if the service is active. Used for the Zabbix monitoring system.

EndPoint/URL:  ServiceUrl/getservicestatus.

Request type: POST.

Parameters Body:

ApiKey – authorization key (specified in Web.config).

Response: only returns the “OK” text

Example of a call in Powershell:

$params = @{
"ApiKey"= "ApiKey";
"SiteName"="NameOfSite"
}
Invoke-WebRequest -Uri http://serviceUrl/getservicestatus -Method POST
-Body $params

SaveIndexationConfigs

Gets the SQL files from bpm’online to retrieve data from the application database to the index. Saves the files to the configuration file catalog (RootConfigFolder\IndexName). Populates the GlobalSearchIndexingEntity table, used by the Scheduler component.

EndPoint/URL:  ServiceUrl/saveconfigs.

Request type: POST.

Parameters Body:

IndexationConfigs – JSON with SQL files.

IndexName – global search index name in the application.

AddSite

Adds new website to DB.

EndPoint/URL: ServiceUrl/addsite.

Request type: POST.

Parameters Body:

ApiKey – authorization key (specified in Web.config).

SiteName – website name.

Response:

status: “ok” / ”error”.

message: “Site {Site name} was added successfully.” / “{Error message}”.

code: 200/400.

Example of a call in Powershell:

$params = @{
"ApiKey"= "ApiKey";
"SiteName"="NameOfSite"
}
Invoke-WebRequest -Uri http://serviceUrl/addsite -Method POST -Body
$params

SetSearchState

Sets the global search status (Enabled or Disabled). The website marked as “Disabled” will not participate in indexation.

EndPoint/URL: ServiceUrl/setsearchstate.

Request type: POST.

Parameters Body:

ApiKey – authorization key (specified in Web.config).

SiteName – website name.

SearchState — search status (Enabled/Disabled).

Response:

status: “ok” / ”error”.

message: ““Success. GlobalSearch for site {Site name} was {disabled/enabled}. / “{Error message}”.

code: 200/400.

Example of a call in Powershell:

$params = @{
"ApiKey"="ApiKey";
"SiteName"="NameOfSite"
"SearchState"="Enabled"
}
Invoke-WebRequest -Uri http://serviceUrl/setsearchstate -Method POST
-Body $params

See also

Global search setup

Global search

 

Did you find this information useful?

How can we improve it?