<img src="https://trc.taboola.com/1278851/log/3/unip?en=page_view" width="0" height="0" style="display:none">

TM1 Rest API: Dimensions Metadata Extract

October 8, 2020

TM1 Rest API: Dimensions Metadata Extract

 

The Blog shows how to use TM1 Rest API to extract, filter, select only specific details/properties from the dimensions, all the metadata extracted from TM1 Rest API will be in JSON. If this is your first time on TM1 Rest API, then it is recommended to visit the link below which covers the introduction and helps with getting started on TM1 Rest API.

https://blog.octanesolutions.com.au/introduction-to-tm1-rest-api

Here, we will be using Go_New_Store TM1 Sample Instance in windows environment and Chrome Browser with JSONView Extension

https://<AdminHost>:<PortNumber>/api/v1/

AdminHost: The Server name where the Admin Server is Setup, here localhost will be used.

PortNumber: Http Port number can be found in the Config file for TM1 server.

Above URL is also referred to as the Service Root URL for TM1 Rest API. Now, let's get started by seeing the URL used to get all dimensions and their properties and also, the URL used to get only the specific dimension and its properties

  1. https://localhost:5010/api/v1/Dimensions
  2. https://localhost:5010/api/v1/Dimensions(‘Retailers’)

This URL can be used to get all the dimensions and their properties in that instance (here, Port 5010 is http port for “GO_New_Stores” Sample TM1 Instance)

 

TM1 Rest API: Dimensions Metadata Extract

 

Above URL is used to get properties for the selected dimension. In this case, the properties of the dimension “Retailers” are fetched.

 

TM1 Rest API: Dimensions Metadata Extract

 

Filter:

The Sections shows how the filter can be used on dimensions in detail

  1. https://localhost:5010/api/v1/Dimensions?$filter=indexof(Name,'}') eq 0
  2. https://localhost:5010/api/v1/Dimensions?$filter=not indexof(Name,'}') eq 0
  3. https://localhost:5010/api/v1/Dimensions?$filter=contains(Name,'}ElementAttributes')
  4. https://localhost:5010/api/v1/Dimensions?$filter=startswith(Name,'Re')
  5. https://localhost:5010/api/v1/Dimensions?$filter=endswith(Name,'on')
  6. https://localhost:5010/api/v1/Dimensions?$top=5
  7. https://localhost:5010/api/v1/Dimensions?skip=5
  8. https://localhost:5010/api/v1/Dimensions?$filter=lenth(Name) eq 4
  9. https://localhost:5010/api/v1/Dimensions?$filter=substring(Name,0,2) eq 'Re'

URL uses the filter to get only the control dimensions and their properties

URL gets all the dimensions and their properties excluding the control dimensions

The URL gets all the dimension containing '}ElementAttributes' as a part of the name string property

URL gets all the dimensions name starting with ‘Re’

URL gets all the dimensions name ending with ‘on’

URL gets only the top 5 dimensions from the derived entities

URL Skips the first 5 dimensions from the derived entities

URL gets all the dimensions whose name length equals 4

URL gets all dimensions whose substring matches with ‘Re’

Select:

The Function is used for selecting only the required properties from dimension details fetched.

  1. https://localhost:5010/api/v1/Dimensions?$filter=indexof(Name,'}') eq 0&$select=Name,Attributes/DIMENSION_TYPE

This URL can be used to get all control dimension and only the selected properties such has Name & Dimension type are shows

 

TM1 Rest API: Dimensions Metadata Extract

 

Expand:

This section shows how to navigate from dimensions to hierarchy from there to elements and also, how to use expand in the URL

  1. https://localhost:5010/api/v1/Dimensions('Retailers')/Hierarchies
  2. https://localhost:5010/api/v1/Dimensions?$expand=Hierarchies
  3. https://localhost:5010/api/v1/Dimensions('Retailers')/DefaultHierarchy
  4. https://localhost:5010/api/v1/Dimensions('Retailers')?$expand=DefaultHierarchy($expand=Elements($select=Name,UniqueName,Type,Attributes/Caption))
  5. https://localhost:5010/api/v1/Dimensions('Retailers')/DefaultHierarchy/Elements?$select=Name,UniqueName,Type,Attributes/Caption

URL shows how we can navigate from the dimension to hierarchies for getting hierarchies and it’s property details

 

TM1 Rest API: Dimensions Metadata Extract

 

The URL shows how to use expand to get both dimensions and their properties along with hierarchies and it’s properties

 

TM1 Rest API: Dimensions Metadata Extract

 

Above URL shows the default hierarchy and it’s properties for the selected dimensions

Above URL gets the dimension and its properties, default hierarchy and it’s property along with elements with their selected properties

Above URL show only the elements and their selected properties for the default hierarchy in dimension “Retailers”

 

 

 

Vamshi Krishna G

Vamshi Krishna G

Read more articles by Vamshi

Comments