import requests
url = "https://api.platform.ankra.app/org/applications/{application_id}/saved-log-searches"
payload = {
"name": "<string>",
"query": {
"text": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"not": True
}
],
"span": {
"from": "<string>",
"to": "<string>"
}
}
}
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
query: {
text: '<string>',
filters: [{field: '<string>', value: '<string>', not: true}],
span: {from: '<string>', to: '<string>'}
}
})
};
fetch('https://api.platform.ankra.app/org/applications/{application_id}/saved-log-searches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/applications/{application_id}/saved-log-searches \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--data '
{
"name": "<string>",
"query": {
"text": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"not": true
}
],
"span": {
"from": "<string>",
"to": "<string>"
}
}
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"query": {
"text": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"not": true
}
],
"span": {
"from": "<string>",
"to": "<string>"
}
},
"query_state": "readable",
"created_by": {
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_by": {
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"error_code": "saved_log_search_name_invalid"
}{
"detail": "<string>"
}{
"detail": "<string>",
"error_code": "saved_log_search_name_invalid"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Save a Logs search for an application (browser session)
Saves a search for the application’s Logs, shared with everyone who can read the application: a name and the query the page searches with. The platform checks the query’s shape and bounds and stores it whole; it never runs it. An application keeps at most 50 searches, and no two whose names read the same with capitals aside. The save is audited on the application with the search’s name, never its query. Requires applications.write.
import requests
url = "https://api.platform.ankra.app/org/applications/{application_id}/saved-log-searches"
payload = {
"name": "<string>",
"query": {
"text": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"not": True
}
],
"span": {
"from": "<string>",
"to": "<string>"
}
}
}
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
query: {
text: '<string>',
filters: [{field: '<string>', value: '<string>', not: true}],
span: {from: '<string>', to: '<string>'}
}
})
};
fetch('https://api.platform.ankra.app/org/applications/{application_id}/saved-log-searches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/applications/{application_id}/saved-log-searches \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--data '
{
"name": "<string>",
"query": {
"text": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"not": true
}
],
"span": {
"from": "<string>",
"to": "<string>"
}
}
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"query": {
"text": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"not": true
}
],
"span": {
"from": "<string>",
"to": "<string>"
}
},
"query_state": "readable",
"created_by": {
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_by": {
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"error_code": "saved_log_search_name_invalid"
}{
"detail": "<string>"
}{
"detail": "<string>",
"error_code": "saved_log_search_name_invalid"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
A whole saved search: its name and its query, both required. A replacement replaces both; there is no partial change.
Response
The search is saved; the answer is the search
One search saved for an application's Logs: a name and the query the Logs page searches with. The platform stores the query and never runs it.
readable: the stored query is one the rules accept, and query holds it. unreadable: the stored query is one the rules no longer accept (a member a later release removed, a rule it tightened, a row changed by hand); the search is still listed with its name and who saved it, so it can be replaced or removed, and query is null. Replacing it stores the new query and makes it readable.
readable, unreadable