Tree Structure Views
Introduction
The tree structure views allow to get information from ta resource of the Wedia repository that are structured in a tree. Like usual views, it is a selection of the properties of a unit object and the properties of its related objects.
The tree structure views shows the structure from a selected object or from the root(s). It is also possible to show the path of an object until its roots (ascending) or the other way round (descending) for example to do a breadcrumb.
The tree structure is defined by an object that as a child type property which nature is the same as the object itself. This property is tagged with arbo_field tag. If this structure is not respected the call will return an error.
The mapping of those views are similar to the usual views: so beware not to share the same names between usual views and tree structure view.
Configuration
To each view are a name and a JSON configuration associated.
JSON example
{
"objectname": "section",
"treefieldname": "section",
"orderby": "",
"props": [ "id", "name" ],
"query": "pactivated='1'",
"secured": true
}
Properties and sections
objectname: String - Name of the object (type)
description: String - Short description of action
treefieldname: The property undertaking the link (not mandatory: it will be automatically retrieved if required)
query: Selection query (SQL Wedia)
since 11.19*parameterizedQuery: String or Object - Selection query (SQL syntax) as JSON Query (allowing among other things to make the query parameterisable)
orderby: Sorting algorithm (SQL)
since 11.10sortbyrelevance: Boolean - (Relevant only if query is fulltext) Indicate if results are sorted first by relevance (true) or not (false). Default to true
since 11.10sortbyrelevanceiforderby: Boolean - (Relevant only if query is fulltext) this property allows to deactivate sorting by relevance if an order by clause is configured. If this property is false, sortbyrelevance must be explicity to true to get result sorted by relevance if there is an order by set. Default to true.
secured: Define if we apply security
max: Maximum number of instance to export at each call
from: Number of the first instance to get
fulltext: Textual search criteria
props: Properties sections A table of properties names to be exported. It is possible to export the properties of an linked object by adding a ‘.’ between the name of the property and the property name of the related object.
E.g. for the name of the object, the status name of the object, and the status color HTML code:
[“name”, “status.name”, “status.color.name”].header: An open section that allows to get back as is to the call response
since 11.18queryPolicies: allows you to manage rights on the requestable fields
since 11.18queryPoliciesByRoles: allows you to manage rights on the requestable fields, depending of role of the surfer
EndPoints
There are three endpoints available:
To get a view
To get a branch
To get a list of available views
EndPoint: Get a view
since 11.14
GET http://host:port/app/api/json/tree/{viewName}{/id}
since 11.12
GET http//host:port/app/api/json/tree
Legacy endpoint:
Supported methods: GET, HEAD
Parameters
viewName: String - View identifier
id (or form_id): Root object identifier, or void to have all the roots (objects without father)
withRoot: (false by default)
depth: Desired depth of the tree. For infinite depth use infinite or a negative value. By default the depth is 1. If depth is 0, only the requested object is visible (or roots if no object is requested)
props: Character string: Comma separated names and properties (only properties available in the view can be requested, if blank all properties will be displayed)
query: Character string: A selection request following JSON type specific language (to combine with the configured request). For long requests (above URL maximum lenght), request can be defined in the header X-WEDIA-QUERY, or in the body of the request (supported contenttypes: application/json, text/json)).
orderby: Character string (SQL): Sorting algorithm
since 11.10sortbyrelevance: Boolean - Overrides sortbyrelevance from configuration
secured: A boolean: To apply or not the security (if configuration is applied, then security must be applied)
fulltext: Character string: The text based search criteria
from: An integer: Number of the first requested object
max: An integer: Maximum number of the requested objects
rawValues: A boolean: Indicates if we apply the localization (false by default)
headers: A boolean: Indicates if headers are required (Cf. hereafter, response format) (false by default).
linkPrefix: Allows to indicate the prefix of the children property ($ by default)
Response format
Example
Configuration
Request
Result
Security
The tree action of the RESTAPI domain allows to manage the endpoint call authorisation. There are two parameters:
surfer: surfer
viewName: the view identifier
Errors codes
HTTP Code | API Code | Definition |
---|---|---|
404 | 404/500 | Unknown view |
403 | 403/500 | Unreachable view (or forbidden) |
422 | 422/500 | Unreachable view (configuration problem) |
EndPoint: Get a branch
since 11.14
since 11.12
Legacy endpoint:
Supported methods: GET, HEAD
Parameters
viewName: Character string, view identifier
id (or form_id): Initial node identifier
depth: Number of element to get. For an infinite depth use infinite or a negative valuer. The default depth is 1. The depth 0 allows to see only the current object
ascendant: Sorting order
true (default value): branch is ascending, specified object to its root parent,
false: branch is descending (breadcrumb order).
props: Character string: Comma separated names and properties (only properties available in the view can be requested, if blank all properties will be displayed)
query: Character string: A selection request following JSON type specific language (to combine with the configured request). For long requests (above URL maximum lenght), request can be defined in the header X-WEDIA-QUERY, or in the body of the request (supported contenttypes: application/json, text/json)).
orderby: Character string (SQL): Sorting algorithm
secured: A boolean: To apply or not the security (if configuration is applied, then security must be applied)
fulltext: Character string: The text based search criteria
from: An integer: Number of the first requested object
max: An integer: Maximum number of the requested objects
rawValues: A boolean: Indicates if we apply the localization (false by default)
headers: A boolean: Indicates if headers are required (Cf. hereafter, response format) (false by default).
Response format
Example
Configuration
Request
Result
Security
The branch action of the RESTAPI domain allows the management of endpoint call authorisation. There are two parameters:
surfer: surfer
viewName: the view identifier
Errors codes
HTTP Code | API Code | Definition |
---|---|---|
404 | 404/500 | Unknown view |
403 | 403/500 | Unreachable view (or forbidden) |
422 | 422/500 | Unreachable view (configuration problem) |
EndPoint: available views list
since 11.12
Legacy endpoint:
Supported methods: GET, HEAD
Parameters
viewName: Character string, an optional Regular Expression type filter (by default, all accessible views are displayed)
headers: a boolean that indicates if headers are required or not (Cf. hereafter, response format) (false by default).
Response format
Security
The catalog action of RESTAPI domain allows the management of the endpoint call authorisation. There are two parameters:
surfer: surfer
endPoint: tree value.
Errors codes
HTTP Code | API Code | Definition |
---|---|---|
403 | 403/501 | Unreachable catalog (or forbidden) |