The DSpace OAI-PMH repository exposes an endpoint /hierarchy for API v6, which provides the logical structure of how communities, sub-communities and collections are related. This is documented at https://wiki.lyrasis.org/pages/viewpage.action?pageId=104566810#RESTAPIv6(deprecated)-Hierarchy
As v6 will be deprecated, is there a direct replacement for this endpoint in v7?
There's no reference to it in the documentation https://wiki.lyrasis.org/display/DSDOC7x/REST+API nor can I see anything equivalent in the live demo: https://api7.dspace.org/server/#/server/api

Is there an equivalent of the /hierarchy API endpoint for DSpace 7.x?
There is no exact replacement in DSpace 7 REST API.  But you can retrieve the same information as follows:

Start from the "Top level Communities" search endpoint here: https://github.com/DSpace/RestContract/blob/main/communities.md#search-methods

This will retrieve all the communities at the top of that hierarchy


Then, for each of those top Communities, it's possible to retrieve their sub-communities and sub-collections via the "linked entities"

Sub-Communities: https://github.com/DSpace/RestContract/blob/main/communities.md#subcommunities
Sub-Collections: https://github.com/DSpace/RestContract/blob/main/communities.md#collections



This is how the hierarchy is achieved in the DSpace 7 User Interface when you visit the "/community-list" page, e.g. https://demo7.dspace.org/community-list
