Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

  • default: Object with the user's default query. To set a default, specify the "setdefault" parameter in the /list method.layout.
  • userpresets: An array of user querieslayouts. If the user has not saved any presets, the array is empty.
  • systempresets: An array of predefined and commonly used querieslayouts. Empty if none available.

 

(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:

  • SystemDefault: The system default.
  • UserDefault: The user's default query.
  • User: A user preset saved with a name.

 

string
nameThe 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:

  • id: The field ID.
  • width: A string with the preferred width.

See ./list/fields to get a list of all available fields.

object[]
rowsRows to show per pageint
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
    }
  ]
}}