The system permits to save and load queries"layouts". Layouts are not required if you simply want to query for data. A layout stores:
- The fields to retrieve with a query
- A name of the preset
- The default rows per page
- Other front end specific properties
The methods permit to:
- Current user default querylayout. For example, a user may decide want to always apply a filter when running a query without explicit query stringrender a specific set of fields with specific column widths.
- System presets. Some lists propose predefined and commonly used querieslayouts.
- User presets. As user can save a list of queries layouts with name.
URL
The following URLs permit to get, add, modify or delete layouts. All actions are private to the current user.
(GET) ./list/querieslayouts
(GET) ./list/querieslayouts/default
(PUT) ./list/querieslayouts/userpresets
(PUT) ./list/querieslayouts/default
MANAGE
...
LAYOUTS
The following API methods are available:
URL | Description |
---|---|
(GET) list/querieslayouts | Gets a list of all querieslayouts. This is an object with properties:
|
(PUT) list/querieslayouts/userpresets | Sets a list of user presetslayouts. Include the JSON array in the HTTP BODY. To clear all presets, set an empty array.
|
(GET) list/querieslayouts/default | Gets the user's default query.This is the same object you receive in the "default" property when calling list/queries (see above)layout.
|
(PUT) list/querieslayouts/default | Sets the user's default querylayout. Include the query object in the HTTP BODY. If the body is empty, the system clears the query (no filter applied)restores the user default to the system default.
|
PRESET OBJECT
LAYOUTOBJECT
A preset layout object has these properties:
origin | Describes who created the layout:
| string |
name | The name of the layout. | string |
query | The query string. Not null. An empty string means that no filter will be applied. See Query language | string |
fields | Array of fields to be included in the layout. Each element has these properties:
See ./list/fields to get a list of all available fields. | object[] |
rows | Rows to show per page | int |
aggid | Optional aggregation to include with query results. See ./list/aggregations on available aggregations. You can also include this property individually with each query: ./list | string? |
... | There may be other properties for specific use by the Wordbee Translator system | * |
EXAMPLES
Calling /list/querieslayouts may return:
Code Block |
---|
{{ { "default": { "origin": "System", "Userid": null, "name": "User default", "query": "" }, "userpresets": [{ System default", "fields": [ { "id": "id", "width": null }, { "id": "oreference", "width": null } ], "rows": 20 }, "userpresets": [], "systempresets": [ { "origin": "User", System", "id": null, "name": "MySystem query", "query": "{status} = 1 AND {locked} = false" }, ], "systempresets": [] } default", "fields": [ { "id": "id", "width": null }, { "id": "oreference", "width": null } ], "rows": 20 } ] }} |