The TM1 REST API is a new way of accessing data and everything else in TM1. Rather than being a proprietary API like old TM1 interfaces it is based on web standards making it accessible to a wide range of developers.
REST stands for REpresentational State Transfer and is an architectural style (not a standard) that has become the common way of designing API for applications on the internet. The TM1 REST API does however support the OData standard (v4) which provides a common way for accessing data through queries and also updating data. OData is used by multiple vendors and is supported by companies like Microsoft, SAP and of course IBM.
If you want to become a true TM1 REST API guru you should read up the documentation on the odata.org website. TM1 supports v4 of the standard, you may find examples out on the web that are an earlier version of the standard that won't work with TM1.
What is great about the REST API?
- It is fast! The REST API is built in to the TM1 server, there is no external web servers or parts you need to install. Because of this the REST API has direct access to all of that data stored in memory in your TM1 server.
- It is fast over slow networks! The REST API is optimized for access over the internet, it takes advantage of all of the goodness that is built into the HTTP protocol such as compression, streaming, etc.
- Did I mention it is fast? In our applications, we are noticing no discernible difference in speed when accessing applications from a local server to one that is hosted on the other side of the world. Our application framework Canvas optimizes this further by batching requests so they are returned in milliseconds rather than seconds.
- You can use any programming language. Whatever your favorite programming language is the chances are you can use it with the REST API. As long as there is a HTTP library for your language, you can use it. Examples of these are:
- Java: Apache HTTP Client, okHttp, etc.
- C# and VB.NET: Built into the .NET Framework: System.Net.WebClient and System.Net.HttpWebRequest
- Python: httpie.
- Others: Search github.
- It is very easy to get most information out of TM1, there is even a built-in document that describes the API called $metadata (more on that later).
- It is cloud and big data enabled! I just added that to make the article sounds cooler.
What ARE the hard bits ABOUT the REST API?
If we are going to make an objective assessment of the REST API we also need to understand that it isn't all smooth sailing with the REST API. In fact, because of the points below Cubewise decided to build a framework on top of the REST API called Canvas to help TM1 developers build beautiful user interfaces without all of the scary bits.
- It is low level. The REST API is built to access TM1 objects directly, this is easy for many queries but is more difficult for updating data, accessing application entries and a number of other things.
- Difficult for the traditional Accountant who recently became a TM1 Developer. As stated before, the REST API can be complicated for people without an IT background.
- Little cross-over from existing TM1 concepts and terminology. If you are a long time TM1 person you will be very familiar with functions such as DBRW and SUBNM as well as Active Forms and Slices. These concepts don't exist in the REST API but do in Canvas.
What can you use the REST API for?
Anything, the REST API is NOT a user interface however, it is a way to access objects/data in TM1. It could be used for pretty much anything:
- As an ETL tool to move data into and out of TM1.
- As a data source for a user interface.
- To sync data between TM1 servers.
- To backup data to another source or file.
- Create, update and delete TM1 objects.
Where to next?
Over the coming weeks we will be posting regular articles on how to use the REST API including examples. We will also provide a comparison and reasons why we developed Canvas to leverage the goodness of the REST API and provide something that is easy to work with for regular TM1 developers.