Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A api
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • ironapi
  • api
  • Wiki
  • Api
  • Queries
  • Saved Queries

Saved Queries · Changes

Page history
restructure authored May 25, 2021 by Andrea Pavlovic's avatar Andrea Pavlovic
Hide whitespace changes
Inline Side-by-side
API/Queries/Saved-Queries.md 0 → 100644
View page @ 1ac51e9a
The entity extensions.query is used to save queries. It takes the same arguments "attrs" and "conds" as [[General Queries]]. It is a normal entity, so all endpoints work as usual. The only difference is that the [[General Queries]] endpoint knows it is the entity where saved queries are stored.
To save a query, call
`/data/extensions/query/transitions/create`
```JSON
{
"entity": "98",
"name": "employee filter",
"conds": {"date_of_birth": {"<":"1994-03-28"}},
"atts": {},
"is_default": "FALSE",
}
```
this will return the query id which can then be used on the entity.
If `is_default` is set, it will be set as the new default search for the entity.
### Calling a query
`/data/$module/$entity/query?id=$id`
In addition to the id, the general paging parameters (limit, offset, page, page_size, no_filtered_count) can be used.
It is also possible to overload the search `conds` and the `order_by` flag, `attrs` will be ignored.
```
/data/$module/$entity/query?id=$id&conds={"id":"3"} -> works, returns entry with id=3
/data/$module/$entity/query?id=$id&order_by=$column -> works, returns list in that order
/data/$module/$entity/query?id=$id&attrs={"bla":"blubb"} -> does not work, attrs are ignored
```
### Invalid queries
A query can become invalid if the underlying database model changes. It will be flagged as invalid once it's been used and produced an error. A subsequent database model change sets all queries with is_valid=FALSE to is_valid=NULL and the query will be tested when it's next used. After that, it's is_valid flag is set again.
* is_valid=TRUE -> worked last time it was used
* is_valid=FALSE -> failed last time it was used
* is_valid=NULL -> state unknown after model change
### Caching
All queries are cached by the api, and get updated when there is a change. To rebuild the cache (at system startup or when there is a problem), execute:
script/cache_update.pl --no-create-schema-files --no-dump-errors
\ No newline at end of file
Clone repository
  • API
    • Available Endpoints
    • Changing Passwords
    • Form Input Types
    • Introduction
    • Logout
    • Plugins
    • Queries
    • Queries
      • Attributes
      • Context
      • Query Examples
      • Query Search Options
      • Referenced Instances
      • Saved Queries
    • Schema_Changes
    • Storing Files
View All Pages