Planning Analytics

Planning Analytics

Get AI-infused integrated business planning

 View Only
Expand all | Collapse all

TM1Py No response returned

  • 1.  TM1Py No response returned

    Posted Mon June 20, 2022 07:24 PM
    Hi all,
    I'm a TM1 REST API newbie, I must confess.

    I'm trying to connect to a tm1 database named "bonificaciones" on cloud, so I have this code:

    from TM1py import TM1Service
    with TM1Service(
    base_url='https://xxxdev.planning-analytics.cloud.ibm.com/tm1/api/Bonificaciones',
    user="xxxdev01_tm1_automation",
    namespace="LDAP",
    password="XXXXXXXXXXXXX",
    ssl=True,
    verify=True,
    async_requests_mode=True) as tm1:
    print(tm1.server.get_product_version())

    When I run the code I get this response:

    Traceback (most recent call last):
    File "C:\Users\M47589\Downloads\tm1py\tm1py-samples-master\my_check.py", line 3, in <module>
    with TM1Service(
    File "C:\Users\M47589\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\TM1Service.py", line 15, in __init__
    self._tm1_rest = RestService(**kwargs)
    File "C:\Users\M47589\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 201, in __init__
    self._start_session(
    File "C:\Users\M47589\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 370, in _start_session
    raise ValueError(f"No response returned from URL: '{self._base_url + url}'. "
    ValueError: No response returned from URL: 'https://xxxdev.planning-analytics.cloud.ibm.com/tm1/api/Bonificaciones/api/v1/Configuration/ProductVersion/$value'. Please double check your address and port number in the URL.

    Any ideas what I'm doing wrong?
    Help will be much appreciated.



    ------------------------------
    Jose Luis Senas
    Data Analyst
    Kimberly-Clark Mexico
    Mexico City
    ------------------------------

    #PlanningAnalyticswithWatson


  • 2.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 12:47 AM
    Hi Jose,
    The code looks correct to me.
    Have you checked that the non-interactive account exists in your DB and has sufficient permissions e.g. DataAdmin whilst testing?

    ------------------------------
    George Tonkin
    ------------------------------



  • 3.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 10:43 AM
    Hi George,
    Thanks for your response and your time.
    I checked if the user exists and has sufficient permissions. Added the user to the DataAdmin group, then I tried again, same result.
    Also I reviewed the tm1s.cfg file looking for HTTPPortnumber, which equals to 17474.
    So, I tryed on my browser (Microsoft Edge): https://xxxdev.planning-analytics.ibmcloud.com:17474/api/v1/$metadata and I've got a connection timed out error.
    Regards.

    ------------------------------
    Jose Luis Senas
    Data Analyst
    Kimberly-Clark Mexico
    Mexico City
    ------------------------------



  • 4.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 12:59 PM
    Hi Jose,
    Valid HTTP port numbers are between 5000 and 49151.
    Try to update this setting,
    Best Regards,

    ------------------------------
    Svetlana Pestsova
    IBM Planning Analytics Product Manager
    ------------------------------



  • 5.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 01:57 PM
    Hi Svetlana,
    Thanks for your response and your time.
    I'm sorry, but I think 17474 is between 5000 and 49151, am I right?
    Regards.

    ------------------------------
    Jose Luis Senas
    Data Analyst
    Kimberly-Clark Mexico
    Mexico City
    ------------------------------



  • 6.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 02:10 PM
    Sorry - you're correct, Jose - that I was going to mention as well was to make sure you're not clashing with another servers for the port number.
    I've not seen the exact error you're getting but was suspecting  the possible case. 
    Best Regards,

    ------------------------------
    Svetlana Pestsova
    IBM Planning Analytics Product Manager
    ------------------------------



  • 7.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 02:28 PM

    Hi Jose,

    Your URL may be incorrect.

    In your Python script you had 'https://xxxdev.planning-analytics.cloud.ibm.com/tm1/api/Bonificaciones'
    It should be probably be 'https://xxxdev.planning-analytics.ibmcloud.com/tm1/api/Bonificaciones'

    Your second test would probably have worked on local but AFAIK, cloud needs a URL like the following as well as some headers to authenticate:
    {{protocol}}://{{serverName}}/tm1/api/{{dbName}}/api/v1/$metadata

    Hope it is as simple as changing the URL in your Python script.



    ------------------------------
    George Tonkin
    ------------------------------



  • 8.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 02:54 PM
    Hi George,
    Thanks again for your time.
    I've made the change and worked out. Now the response is:

    11.8.01100.20

    Many, many thanks again.
    Regards.

    ------------------------------
    Jose Luis Senas
    Data Analyst
    Kimberly-Clark Mexico
    Mexico City
    ------------------------------



  • 9.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 03:01 PM
    Glad to hear it worked out for you!

    Have a look in the Blogs section as there are some REST API topics that may be of interest.

    ------------------------------
    George Tonkin
    ------------------------------



  • 10.  RE: TM1Py No response returned

    Posted Tue June 21, 2022 05:07 AM
    Hi Jose,

    I would recommend you to post your TM1py question on GitHub: https://github.com/cubewise-code/tm1py/issues. You will reach all the TM1py community by posting your question on GitHub.

    Cheers,

    Vincent

    ------------------------------
    Vincent Viau
    ------------------------------