Create a saved search
const url = 'http://api.disclosebot.localdev:3000/v1/saved_searches';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"data":{"type":"saved_search","attributes":{"name":"example","query":{"q":{"additionalProperty":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"]},"results":{"additionalProperty":{"additionalProperty":"example"}}}}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
object
object
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
object
object
object
Responses
Section titled “ Responses ”Created
object
object
object
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
object
object
object
The query as conditions: part (q or results), attribute, label, predicate, predicate_label, value, value_label
object
The value as shown: brief names for a brief condition
The user who saved it from the app; null when created over the API
object
object
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