Create Saved Search
Create a saved search using the REST API.
Request
POST <tenant URI>/personal/savedSearches
| Parameters | Name | Required | Details |
|---|---|---|---|
| Headers | Authorization |
Yes | Information about authentication access token in format "Bearer
<accessToken>" (see details in Authentication API ). |
Content-Type |
Yes | Should be "Content-Type: application/json". |
|
| Body | Yes |
JSON Array with objects representing saved search request objects to create. Each object must have "name" and "query" properties, all other are optional. |
|
| Query |
onBehalfOf
|
No | If current user is tenant admin, he can specify user name in this field for whom he is going to create saved search request. |
Response
Array with results for each element of a request. Each result will have the following properties:
index- index of request object in responded JSON Array.URI- URI of entity object that is created. Returned only if an object was created successfully.object- request object created.-
error- if an object can't be created for some reason. Contains details of the problem. Returns only if an object wasn't created. (See details in Error /*link*/).- Possible Errors:
warning- if object is created but there were some problems.status- result of operation; possible values are "OK" or "failed"
- Possible Errors:
Request
POST <tenant URI>/personal/savedSearches
Headers:Authorization:Bearer 204938ca-2cf7-44b0-b11a-1b4c59984512,
Content-Type:application/json
Body:[
{
"name":"super-search #1",
"description":"bla-bla...",
"query":"filter=(equals(type,'configuration/entityTypes/HCP'))",
"isFavorite":true,
"isPublic":false,
"uiState":{
"searchPanelLength":32,
"searchPanelWidth":256
}
},
{
"name":"super-search #2",
"query":"filter=(equals(type,'configuration/entityTypes/Location'))",
"isFavorite":false,
"isPublic":true,
"uiState":{
"showSearchPanel":true
}
}
]
If you need to use a semicolon in a query, percent encode the semicolon character. The percent
encoding of the semicolon character is 3B. Here is an example
of the string "test;aftersemicolon" using percent encoding:
...
"query": "filter=equals(type,'configuration/entityTypes/HCP')
and equals(attributes.FirstName,'test%3Baftersemicolon')
&options=searchByOv,ovOnly",
...
Response
[
{
"index":0,
"object":{
"URI":"searchRequests/01LBxoX",
"name":"super-search #1",
"description":"bla-bla...",
"query":"filter=(equals(type,'configuration/entityTypes/HCP'))",
"isFavorite":true,
"uiState":{
"searchPanelLength":32,
"searchPanelWidth":256
},
"createDate":1398116799771,
"isPublic":false,
"owner":"mike"
},
"successful":true
},
{
"index":1,
"object":{
"URI":"searchRequests/01LC24n",
"name":"super-search #2",
"query":"filter=(equals(type,'configuration/entityTypes/Location'))",
"isFavorite":false,
"uiState":{
"showSearchPanel":true
},
"createDate":1398116799812,
"isPublic":true,
"owner":"mike"
},
"successful":true
}
]