Skip to main content
Skip table of contents

Plan group tree

Plan group tree

If the number of plan group tree elements is greater than specified in the env variable TREE_MAP_SINGLE_REQUEST_MAX_GROUPS_COUNT, then the tree will be built according to the following principle:

The query returns a list of groups of the 1st nesting level. nesting level you need to specify the group_id of the parent group. Using the has_items parameter, you can determine whether a group contains maps. that this group contains maps. The has_groups parameter can be used to determine whether a group contains nested groups. that this group contains nested groups.

If there are fewer elements of the map tree than in the env variable TREE_MAP_SINGLE_REQUEST_MAX_GROUPS_COUNT, then the entire tree will be returned in 1 request.

To get a list of maps from a group, you must use a list request maps specifying the group_id parameter VMS Client/Maps/Plans/List of plans

In order to exclude a group from the tree, it is necessary to pass exclude_group_id, in this case this group and all its children will not participate in the formation of the tree structure. For search only by group use parameter search_group=group_name instead of a parameter search

GET /api/v1/maps/tree

Parameters

integer group_id, Id of the parent group


string search, Search by address and map name


string search_group, Search by address and group name


integer exclude_group_id, Group id, that must be excluded

200 OK

Successful response

JSON
[
    {
        "id": 1,
        "name": "test1",
        "has_items": false,
        "has_groups": true,
        "children": [
            {
                "id": 3,
                "name": "test3",
                "has_items": true,
                "has_groups": false,
                "children": []
            }
        ]
    },
    {
        "id": 2,
        "name": "test2",
        "has_items": false,
        "has_groups": false,
        "children": []
    }
]

401 Unauthorized

Authorization token not sent or not valid

422 Unprocessable Entity

Returns a JSON object with an error.

JSON
{
    "message": "There will be no informative message here",
    "errors": {
        "any_key": [
            "The cause of the error will be described here"
        ]
    }
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/v1/maps/tree' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "group_id": "integer",
    "search": "string",
    "search_group": "string",
    "exclude_group_id": "integer"
}'
PHP
PHP
$data = array (
  'group_id' => 'integer',
  'search' => 'string',
  'search_group' => 'string',
  'exclude_group_id' => 'integer',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'GET',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v1/maps/tree', false, $context);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.