Skip to content

Create a saved search

POST
/v1/saved_searches
curl --request POST \
--url http://api.disclosebot.localdev:3000/v1/saved_searches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "data": { "type": "saved_search", "attributes": { "name": "example", "query": { "q": { "additionalProperty": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ] }, "results": { "additionalProperty": { "additionalProperty": "example" } } } } } }'

Creates a saved search from a name and a two-part query. Unknown keys and predicates are dropped; a query with nothing left is refused.

Media type application/json
object
data
required
object
type
required
string
Allowed values: saved_search
attributes
required
object
name
required
string
query
required

A report query in two parts. q: ransack predicates over title_or_description, title, description (cont, not_cont, eq, not_eq), submitted_through_id (the brief, an array of brief ids; in, not_in), created_at (gteq, lteq), encrypted (eq). results: result key (severity, validity, scope, duplicate, summary, or any key an integration wrote) to predicate (eq, not_eq, cont, not_cont, gteq, lteq) to value. A channel keeps results conditions but ignores them at evaluation, and applies a brief condition to its briefs instead of storing it. A flat object of ransack predicates is accepted and stored as q.

object
q
object
key
additional properties
One of:
string
results
object
key
additional properties
object
key
additional properties
string

Created

Media type application/json
object
data
required
object
id
required
string format: uuid
type
required
string
Allowed values: saved_search
attributes
required
object
name
required
string
query
required

A report query in two parts. q: ransack predicates over title_or_description, title, description (cont, not_cont, eq, not_eq), submitted_through_id (the brief, an array of brief ids; in, not_in), created_at (gteq, lteq), encrypted (eq). results: result key (severity, validity, scope, duplicate, summary, or any key an integration wrote) to predicate (eq, not_eq, cont, not_cont, gteq, lteq) to value. A channel keeps results conditions but ignores them at evaluation, and applies a brief condition to its briefs instead of storing it. A flat object of ransack predicates is accepted and stored as q.

object
q
object
key
additional properties
One of:
string
results
object
key
additional properties
object
key
additional properties
string
conditions
required

The query as conditions: part (q or results), attribute, label, predicate, predicate_label, value, value_label

Array<object>
object
part
string
Allowed values: q results
attribute
string
label
string
predicate
string
predicate_label
string
value
One of:
string
value_label

The value as shown: brief names for a brief condition

string
created_by_id

The user who saved it from the app; null when created over the API

string format: uuid
nullable
created_at
required
string format: date-time
updated_at
required
string format: date-time
relationships
object
organization
object
channels

The channels whose pre-filter references this search

object
Example
{
"data": {
"type": "saved_search",
"attributes": {
"conditions": [
{
"part": "q"
}
]
}
}
}

Unauthorized

Blank name, duplicate name, or empty query