Aug 2, 2020
Connecting to the IBM Cloud remotely with TM1py
In this article, we explain how you can use TM1py from your laptop/desktop and connect remotely to the IBM Cloud via the REST API.
The key to connecting to the REST API is to have the correct URL (base_url) for your TM1 instance that looks like this:
https:// <hostname>.ibmcloud.com/tm1/api/<folderInWhichDataReside>/
The Folder in which the data reside on the IBM cloud can be different than the instance name (Check with the IBM Cloud team).
To connect to an instance in the IBM Cloud, the TM1Service needs the following parameters:
-
base_url
follows this pattern:https:// <hostname>.ibmcloud.com/tm1/api/<
folderInWhichDataReside> - namespace must be “LDAP”
-
user
non_interactive_user -
password
password for non_interactive_user -
verify
must be True -
async_requests_mode
must be True
To test the connection with your instance you can use the code below (after replacing all parameters):
from TM1py import TM1Servicewith TM1Service( base_url='https://hostname.planning-analytics.ibmcloud.com/tm1/api/tm1_database_name/', user="user", namespace="LDAP", password="xxxx", ssl=True, verify=True, async_requests_mode=True) as tm1: print(tm1.server.get_product_version())
If the connection is successful, the code above will print the TM1 version number.
Give the TM1 Non-Interactive Account Admin Access
After you have logged in you will need to add the TM1 non-interactive user to the Admin group if it hasn’t been added already. To do this:
- Login in to Architect with your IBM Id
- Right-click on the server: Security > Clients/Groups
- Find the TM1 automation user and tick the Admin group box.
- Close the browser and log back into Arc.