This endpoint retrieves the Organizations the current user can see, as a flat list or as a nested tree.
Request
To retrieve the Organization Hierarchy visible to the user of the token, make a GET request to the following URL:
| HTTP Method | URL |
|---|---|
| GET | https://nanoview-api.wellairsolutions.com/api/v2.0/users/me/_/organizations/ |
Without parent, the response starts at the user's root Organizations: the ones that have no parent, or whose parent the user cannot see. With parent, it starts below that Organization.
Query Parameters
| Parameter | Type | Required? | Default | Description |
|---|---|---|---|---|
| parent | String | No | — | ID or label of the Organization to start from. Labels use the prefix ~ |
| depth | String | No | 0 without parent, 1 with it | Levels below the starting point to include: 0 to 6, or all for the whole subtree. depth=0 without parent returns only the roots |
| format | String | No | flat | flat returns a paginated list in which each item has its depth. tree returns a plain array, not paginated, with each node's children nested under children |
| tags__contains | String | No | — | Only Organizations whose tags contain this exact tag, for example space |
| search | String | No | — | Case-insensitive partial match on label, name or description |
| isActive | Boolean | No | — | true keeps only active Organizations and false only inactive ones. Omit it to get both |
| page | Number | No | 1 | Page number, only with format=flat |
| page_size | Number | No | 50 | Items per page, up to 200, only with format=flat |
| token | String | No | — | Authentication Token can optionally be sent as a query parameter |
depth, the roots andhasChildrenare computed over the whole visible tree beforeisActive,tags__containsandsearchare applied.- With
format=treeandparent, the array has a single entry: the starting Organization, wrapping its descendants. It is always returned, even when it does not match the other filters.
Header
| Parameter | Required? | Description |
|---|---|---|
| X-Auth-Token | Yes | Authentication Token of the user |
$ curl -X GET 'https://nanoview-api.wellairsolutions.com/api/v2.0/users/me/_/organizations/?depth=all&format=tree' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73'{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "64a1b2c3d4e5f60001234568",
"label": "north-tower",
"description": "North Tower",
"depth": 0,
"tags": ["building"],
"isActive": true,
"parent": "64a1b2c3d4e5f60001234567",
"hasChildren": true
},
{
"id": "64a1b2c3d4e5f60001234569",
"label": "north-tower-floor-1",
"description": "",
"depth": 1,
"tags": ["floor"],
"isActive": true,
"parent": "64a1b2c3d4e5f60001234568"
}
]
}[
{
"id": "64a1b2c3d4e5f60001234568",
"label": "north-tower",
"description": "North Tower",
"depth": 0,
"tags": ["building"],
"isActive": true,
"parent": "64a1b2c3d4e5f60001234567",
"children": [
{
"id": "64a1b2c3d4e5f60001234569",
"label": "north-tower-floor-1",
"description": "",
"depth": 1,
"tags": ["floor"],
"isActive": true,
"parent": "64a1b2c3d4e5f60001234568",
"children": [
{
"id": "64a1b2c3d4e5f60001234571",
"label": "north-tower-room-101",
"description": "",
"depth": 2,
"tags": ["space"],
"isActive": false,
"parent": "64a1b2c3d4e5f60001234569",
"children": []
}
]
}
]
}
]{
"code": 400001,
"message": "Validation Error.",
"detail": {
"depth": ["\"9\" is not a valid choice."]
}
}{
"code": 401001,
"message": "Authentication credentials were not provided."
}{
"code": 404001,
"message": "The request was not found."
}Response
With format=flat, an object with the Organizations in the results key. With format=tree, an array of root nodes with their children. Each node has:
| Property | Type | Description |
|---|---|---|
| id | String | ID of Organization |
| label | String | Label of Organization |
| description | String | Description of Organization |
| depth | Integer | Depth relative to the starting point of this response: 0 for a root, or for the parent that was sent |
| tags | String Array | Tags of Organization |
| isActive | Boolean | True if Organization is active. Every user, End Users included, also sees the inactive Organizations they have access to |
| parent | String | ID of the parent Organization, or null for a root. It is the real parent, even when the user cannot see it and the node is reported as a root |
| hasChildren | Boolean | Present, and always true, only when the node has children that are not in this response (because of depth, or of a filter). It is never false |
| children | Array | Only with format=tree: the nested nodes |
404 Not Foundwhenparentdoes not match an Organization the user can see.400 Bad Requestwhen a~labelsent inparentmatches several Organizations the user can see and none, or more than one, of them is active; or whendepth,formatorisActivehave a value that is not valid.- The nodes do not include
name. To read the full Organization object, use Get Organization or Get all Organizations with thedescendant_offilter.
