Get spaces - Metasys - LIT-12013522 - Software Application - Basic Services client library for .NET (and COM) - Metasys API - 4.2

Metasys REST Client for .NET and COM Developer Guide

Product name
Basic Services client library for .NET (and COM)
Metasys API
Document type
API Reference Guide
Document number
Revision date
English (United States)

To get all available spaces on an object use the GetSpaces method, the library delivers a list of MetasysObject.

Table 1. Get spaces .NET signature
Library method name GetSpaces
Description Get available spaces on your server.
Method signature IEnumerable<MetasysObject>GetSpaces(SpaceTypeEnum? type = null)
Method input parameters Optional

type: the type of space the method uses to filter the values to return.

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();
    "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();
    "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