./list/layouts

./list/layouts

The system permits to save and load "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 layout. For example, a user may want to always render a specific set of fields with specific column widths.

  • System presets. Some lists propose predefined and commonly used layouts.

  • User presets. As user can save a list of 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/layouts

(GET) ./list/layouts/default

(PUT) ./list/layouts/userpresets

(PUT) ./list/layouts/default

 

MANAGE LAYOUTS

The following API methods are available:

 

URL

Description

(GET) list/layouts

Gets a list of all layouts. This is an object with properties:

  • default: Object with the user's default layout.

  • userpresets: An array of user layouts. If the user has not saved any presets, the array is empty.

  • systempresets: An array of predefined and commonly used layouts. Empty if none available.

 

(PUT) list/layouts/userpresets

Sets a list of user layouts. Include the JSON array in the HTTP BODY.

To clear all presets, set an empty array.

 

(GET) list/layouts/default

Gets the user's default layout.

 

(PUT) list/layouts/default

Sets the user's default layout. Include the query object in the HTTP BODY.

If the body is empty, the system restores the user default to the system default.

 

 

LAYOUTOBJECT

A 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

name

The name of the layout.

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[]

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/layouts may return:

{{ "default": { "origin": "System", "id": null, "name": "System default", "fields": [ { "id": "id", "width": null }, { "id": "oreference", "width": null } ], "rows": 20 }, "userpresets": [], "systempresets": [ { "origin": "System", "id": null, "name": "System default", "fields": [ { "id": "id", "width": null }, { "id": "oreference", "width": null } ], "rows": 20 } ] }}

 

 

 

 

Copyright Wordbee - Buzzin' Outside the Box since 2008