TM1 REST API ( Any early adopters )

RJ!
Community Contributor
Posts: 219
Joined: Mon Jul 23, 2012 8:31 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by RJ! »

I'll keep keep testing it till I can get a response I guess.
nick_leeson
Posts: 98
Joined: Sat Feb 11, 2012 11:13 am
OLAP Product: TM1 9x, BPC, Hyperion, HANA
Version: TM1 10
Excel Version: Excel 2003 - 2010

Re: TM1 REST API ( Any early adopters )

Post by nick_leeson »

Have a read through this https://developer.chrome.com/extensions/xhr but I am still confused whether using session id will be enough for you to get REST API working.

Best of luck.
RJ!
Community Contributor
Posts: 219
Joined: Mon Jul 23, 2012 8:31 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by RJ! »

After many, many hours... And remebering a few things from last years TM1 Conference I finally cracked it!!

All you need is Dojo and a method to insert your Username & Password as Base64.

The JavaScript Code is as easy as:

Code: Select all

require([ "dojo/request" ], function (request) {
   request("http://Localhost:port/api/v1/Processes", {
      headers: {
         "X-Requested-With": null,
         "Authorization": Basic *Username:password
        },
        withCredentials: true
    });
});
*Encoded as Base64

This is obviously the most basic way of getting connected to the REST API while using "IntegratedSecurityMode=1 or 2".
I'm not sure about the NTLM methods though am assuming it will be similar except for the Token instead of username:password.

If you have any improvements to the code, please add them here!!
RJ!
Community Contributor
Posts: 219
Joined: Mon Jul 23, 2012 8:31 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by RJ! »

I'm now trying to use SSL so make the connection a bit more secure.

I have:
Updated the tm1s.cfg with the below parameters:
HTTPSPortNumber=XXXX
UseSSL=T


My HTML landing page is:
http://myTM1Server:XXXX/tm1web/test/test.html


My POST request is:
https://myTM1Server:XXXX/api/v1/Cubes('Fin_GL')/Views('Default')/tm1.Execute

Is changing the POST request from HTTP to HTTPS all that is required to get SSL to work?
Are there any other parameters or settings that need to be changed anywhere?

I get a timeout error when executing that post command at the moment, I didn't get that when SSL was not activated.
lotsaram
MVP
Posts: 3683
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: TM1 REST API ( Any early adopters )

Post by lotsaram »

Pretty sure the config parameter remains HTTPPortNumber and you just change UseSSL to true.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
RJ!
Community Contributor
Posts: 219
Joined: Mon Jul 23, 2012 8:31 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by RJ! »

so should my "post" command use "https"?
User avatar
qml
MVP
Posts: 1095
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: TM1 REST API ( Any early adopters )

Post by qml »

RJ! wrote:so should my "post" command use "https"?
Yes, just not your tm1s.cfg parameter.
Kamil Arendt
anmolmalhotra
Posts: 1
Joined: Tue Mar 08, 2016 4:24 am
OLAP Product: Tm1
Version: 10.2.2
Excel Version: 2007

Re: TM1 REST API ( Any early adopters )

Post by anmolmalhotra »

Hi Folks,
I am bit new in using TM1 rest api, i have a same problem of sending the post request to the server.I don't want to use jquery , can someone got the another way of doing that.
Also without any plugins :?: :?: :?:
RJ!
Community Contributor
Posts: 219
Joined: Mon Jul 23, 2012 8:31 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by RJ! »

I've seen a generic "Login/Test" page that was created by an IBM Dev that's supposedly out in the wild now.
It allows you to login, test your GET & POST commands and see the resulting data from TM1.

I'm sure if you ask your IBM rep or TM1 consultant really nicely, they'll give it to you.
whitej_d
Community Contributor
Posts: 103
Joined: Mon Sep 05, 2011 11:04 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

TM1 Rest API and Google Sheets

Post by whitej_d »

I used this tool which was very helpful for querying the TM1 rest API - Post or Get, including authentication:

https://www.hurl.it/

I actually managed to host a TM1 server on an Amazon AWS instance, and then using the REST Api, successfully managed to get a cube view onto a Google Sheet using a Google script. I'll attach the script in case it helps anyone get started, but I'm not a programmer and it's really just me hacking around, so it's not pretty! The Amazon server isn't running either, so don't expect it to work as is!

I also tried to turn DBRW into a function for google using a google worksheet to query the Rest API. It worked, but due to the way Google scripts run on a separate server to the Google sheet itself, there doesn't seem to be a way of getting anything like DBRW functionality onto Google with adequate performance.
Attachments
Google Apps Script Query TM1 Rest API.txt
(5.93 KiB) Downloaded 484 times
whitej_d
Community Contributor
Posts: 103
Joined: Mon Sep 05, 2011 11:04 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by whitej_d »

For the sake of sharing, here was my attempt at DBRW functionality in Google Sheets using Google script and the TM1 Rest API. As I mentioned, I think it's a dead end due to the way the cache service is on a different server to the sheet service and communication between the two is too slow to put the data in the relevant place.
Attachments
Google Script DBRW attempt.txt
(8.03 KiB) Downloaded 466 times
ambrus
Posts: 10
Joined: Thu Nov 19, 2009 1:13 pm
OLAP Product: Manny's TM1
Version: 10.2.2
Excel Version: 2010
Contact:

Re: TM1 REST API ( Any early adopters )

Post by ambrus »

For anybody interested in interactively learning and exploring the Rest API of TM1 I can only recommend the swagger UI. For the good of the community find it hosted (and connected to a Planning Sample model) on http://swagger-ui.cubeac.com
Blog post with further details: http://cubeac.com/blog/learning-tm1-res ... wagger-ui/

Cheers,
Ambrus
Rest API addict, creator of http://cubeac.com || Blog http://cubeac.com/blog/
pramodbugudai
Posts: 1
Joined: Thu Sep 29, 2016 9:58 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: TM1 REST API ( Any early adopters )

Post by pramodbugudai »

Check this URL will help you for sure.

http://www.canvasfortm1.com/blogs/2016/ ... 1-rest-api
Post Reply