To get all available spaces on an object use the GetSpaces
method, the library delivers a list of MetasysObject
.
Library method name |
GetSpaces
|
---|---|
Description | Get available spaces on your server. |
Method signature |
IEnumerable<MetasysObject>GetSpaces(SpaceTypeEnum? type = null)
|
Method input parameters |
Optional
|
Return value | A collection of MetasysObject that represent spaces. |
The following .NET C# code is an example of a successful response to get spaces method:
// Retrieves the list of Buildings using SpaceTypeEnum helper
List<MetasysObject> buildings = client.GetSpaces(SpaceTypeEnum.Building).ToList();
MetasysObject building = buildings.LastOrDefault();
Console.WriteLine(building);
/*
{
"ItemReference": "Win2016-VM2:Win2016-VM2/JCI.Building 1",
"Id": "164aaba2-0fb3-5b5d-bfe9-49cf6b797c93",
"Name": "North America (BACnet)",
"Description": null,
"Type": 2,
"TypeUrl": "https://win2016-vm2/api/v2/enumSets/1766/members/1",
"Category": "Building",
"Children": [],
"ChildrenCount": 0
}
*/
// Retrieves all the spaces in a flat hierarchy
List<MetasysObject> spaces = client.GetSpaces().ToList();
MetasysObject firstSpace = spaces.FirstOrDefault();
Console.WriteLine(firstSpace);
/*
{
"ItemReference": "Win2016-VM2:Win2016-VM2/JCI.Building 1.Floor 1.Milwaukee.507 E Michigan Street Campus",
"Id": "896ba096-db3c-5038-8505-636785906cca",
"Name": "507 E Michigan Street Campus",
"Description": null,
"Type": 2,
"TypeUrl": "https://win2016-vm2/api/v2/enumSets/1766/members/3",
"Category": "Room",
"Children": [],
"ChildrenCount": 0
}
*/