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

Blog

Introduction to TM1 REST API

[fa icon="calendar"] June 2, 2020 / by Rajan Bajracharya

Rajan Bajracharya

REST stands for REpresentational State Transfer. It is web standard-based architecture and uses HTTP Protocol. TM1 REST API is a type of web service which can be used to perform create, read, update, and delete operations on TM1 objects or data. Therefore, we can maintain a TM1 model, manage TI processes, chores, dimensions and query data that is stored in the model.

TM1 REST API provides an Open Data Protocol (OData) Version 4 compliant interface to TM1 server, which allows clients to query and update data sources that are hosted by TM1 Server. The OData standard defines a set of rules and guidelines that are derived from common web technologies that include HTTP, REST, XML, and JSON. Below picture will explain how TM1 REST API works.

2-3

 

The request is sent from client to server in the form of web URL as HTTP GET or POST or PATCH or DELETE. After that a response comes back from server in the form of resource which can be anything like HTML, XML, JSON. But now JSON is the most popular format being used in Web Services.
Now, let’s understand various HTTP methods used in TM1 REST API. There are 4 methods commonly used in TM1 REST API which are GET, POST, PATCH and DELETE. Let’s go through each method.

  • GET: - HTTP GET method can be used to perform READ operation on TM1 objects. We can get details of TI process, chore dimension, cubes using this method. 
  • POST: - HTTP POST method can be used to perform WRITE/CREATE operation on TM1 objects. We can create new process, chore, dimension and cubes using this. Also, various TM1 objects can be retrieved from source TM1 instance using GET method and transferred to other TM1 instance using POST method.
  • PATCH: - HTTP PATCH method can be used to perform UPDATE operation on TM1 objects. We can update content of various tabs of TI process like Prolog, Epilog , Metadata and data, Rule file etc using this method.

 

  • DELETE: - HTTP DELETE method can be used to perform DELETE operation on TM1 objects.



Prerequisite 
The prerequisite for TM1 REST API is to have basics of TM1 and Adminhost and HTTPPortNumber details of the instance which you are trying to access. 

URLs for Process

  • https://"+Adminhost+":"+portnumber+"/api/v1/Processes



It will give details of each processes available in TM1 instance if we are using GET function or accessing it through a web browser. While accessing it through web browser by default GET function is called.  The output will be in Json format and can be viewed in proper structure using “http://jsonviewer.stack.hu/” URL. Let’s see the output of this URL while accessing it in a web browser.

We need to give username and password of TM1 instance in this screen.

3-1

 

After providing the credentials we will get output in Json format, paste the output in http://jsonviewer.stack.hu/ URL’s Text tab and then go to viewer tab. We will get output similar to below screen.

4-1



We can use same URL to transfer or post process to other TM1 instance using POST function.

  • https://"+Adminhost+":"+portnumber+"/api/v1/Processes('"+process_name+"')

 


It will give details of particular process whose name is specified in the URL.
URLs for Chore

  • https://"+Adminhost+":"+portnumber+"/api/v1/Chores

 

5

 

It will give details of Properties of Chores (Name, Frequency, Execution mode).


  • https://"+Adminhost+":"+portnumber+"/api/v1/Chores('"+chore_name+"')

 

Similar to process, we can use this to get details of particular chore.

  • https://"+Adminhost+":"+portnumber+"/api/v1/Chores('"+chore_name+"')/Tasks?$expand=Process($select=Name)



We can use this to get list of process in a chore.

 

6-1


URLs for Dimension

  • https://"+Adminhost+":"+portnumber+"/api/v1/Dimensions('"+dim_name+"')?$expand=Hierarchies($expand=Elements($select=Name,Type,Level;$expand=Components($select=Name,Type);$expand=Parents($select=Name,Type)))



It will give Details of dimension like dimension name, element name with its parent, component, type and level.

7-1

 

  • https://"+Adminhost+":"+portnumber+"/api/v1/Dimensions('"+dim_name+"')/Hierarchies('"+dim_name+"')/Elements('"+ConsolidatedElement+"')/Components



It can be used to get and post components of consolidated level elements using GET and POST function.

 

8-1

 

  • https://"+Adminhost+":"+portnumber+"/api/v1/Dimensions('"+dim_name+"')/Hierarchies('"+dim_name+"')/ElementAttributes



It can be used to get and post Attribute Name and Type of Dimension (Alias, Text, Numeric) using GET and POST function.

URLs for Cube

  • https://"+Adminhost+":"+portnumber+"/api/v1/Cubes



It will give details of each Cube like Name, Rules.

9-1

 

  • https://"+SourceAdminhost+":"+portnumberSource+"/api/v1/Cubes('"+cube_name+"')?$expand=Dimensions($expand=Hierarchies($expand=Elements($select=Name)))


It can be used to get details of cube along with Dimension Name, Hierarchies and elements Name in Dimension.

10

 

Topics: TM1, TM1 How To, TM1 Support

Rajan Bajracharya

Written by Rajan Bajracharya

Subscribe to Email Updates

Recent Posts