I love it when PA mixes up 'elements' and 'hierarchies' so technically this is a misnomer to begin with (elements live in a graph whereas members live in hierarchies) but because you only start noticing the difference if yo have multi-parent elements people like to mix things up ;-).
That said, kind of expecting you'd actually want all the members anyway if you are looking at a hierarchy, you could simply pull the Members instead of the Elements and, if you needed an Element specific property, expand the Element navigation property of the Member to get to it. I.o.w.
`GET ~/Dimensions('plan_time')/Hierarchies('plan_time')/Members`
gives you all Members in hierarchy order.
But effectively you can grab any collection of Members as long as you express it as an MDX set expression, using the ExecuteMDXSetExpression. Simply pass the MDX expression for the set, in your Hierarchy ordered example simply `Hierarchize( [<<Dimension>>].[<<Hierarchy>>].MEMBERS )` (albeit in this particular case where using Members function the order is, like the set above, Hierarchized by default), and then pull the individual Members from the response.
And if you happened to have multi-parent element and you really only want the first member representing such element (and have all other representation of the same element, as a component under the other parents, omitted) then you could use `Hierarchize( TM1SubsetAll([<<Dimension>>]))` as the MDX expression for the set.
Another way, if you are happy to deal with some nested [JSON] response from the REST API, you could simply grab the Elements of a Hierarchy, filter them to only the 'root' elements (read: elements with no parents) and then expand the components as in:
`GET ~/Dimensions('plan_time')/Hierarchies('plan_time')/Elements?$filter=Parents/$count eq 0&$expand=Components`
this would only give you one level but you can nest this as many levels as you like as in, let's say two extra levels:
`GET ~/Dimensions('plan_time')/Hierarchies('plan_time')/Elements?$filter=Parents/$count%20eq%200&$expand=Components($expand=Components($expand=Components))`
Hope this helps,
------------------------------
Hubert Heijkers
STSM, Program Director TM1 Functional Database Technology and OData Evangelist
------------------------------
Original Message:
Sent: Fri April 05, 2024 03:12 AM
From: Luc Cusiel
Subject: REST API Dimension Element Ordering
I'm not sure if there is a REST API function for this. What you could do through REST API is to run an unbound TI process where you use the DimensionSortOrder function or you could directly write the applicable values to the }DimensionProperties cube.
Kind regards,
Luc
------------------------------
Luc Cusiel
Original Message:
Sent: Thu April 04, 2024 09:04 AM
From: Thilo Thurner
Subject: REST API Dimension Element Ordering
Hi all,
is there a function or action to mimic the "Dimension Element Ordering" ->Automatic Sort By "Hierarchy" in architect via REST API call?

I was looking though the metadata.xml but couldn't find an action.
Best regards,
Thilo
------------------------------
Thilo Thurner
------------------------------