Hi Gaby,
First, the syntax you are using, parens immediately following a property name representing a singleton is nowhere allowed in the OData specification, which is hopefully kind of what the error you got implied.
Secondly, Attributes is a (see the metadata for the service) ComplexType. which indeed, like the sample Stuart showed you, requires you to use path syntax to select properties of such type. On top of that Attributes is an open type (read: can have properties not explicitly defined in the metadata), properties which in this case represent the attributes associated to such element (or any other type that supports attributes in TM1 for that matter). These properties are never auto-expanded in the response and therefore have to be explicitly 'selected' using the forementioned path syntax. If however, a requested property doesn't exist it will simply be ignored in the normal OData JSON response, and represented by a null value if you happened to be using our experimental Compact JSON format.
------------------------------
Hubert Heijkers
------------------------------
Original Message:
Sent: Mon February 10, 2020 06:19 PM
From: Gaby Yuan
Subject: How to get property of a property with restapi?
Hi,
I am hoping to GET all the elements (return code and description which is an attribute) within a subset and the first parent with restapi.
The highlighted syntax is not right, can anyone please show me the correct way to construct the URL?
Dimensions('xx')/Hierarchies('xx')/Subsets('xx')/Elements?$select=Name,Level,Attributes($select=codeanddesc)&$expand=Parents($top=1)
Thanks
Gaby
------------------------------
Gaby Yuan
------------------------------
#PlanningAnalyticswithWatson