cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
189 stars 109 forks source link

Function Applications.update not working #1029

Closed luiz-g-r2 closed 9 months ago

luiz-g-r2 commented 9 months ago

Hi, when trying to update a application, update function fails.

TM1py v1.11.3 ApplicationType=LINK Public

from TM1py import TM1Service
from TM1py.Objects.Application import ApplicationTypes, Application
import configparser, re

with TM1Service(**config['TM1SERVER']) as tm1:
    tm1_application = tm1.applications.get(path, type, name)
    tm1_application.url = new_url    
    tm1.applications.update(tm1_application)

Error:

TM1py.Exceptions.Exceptions.TM1pyRestException: Text: '{"error":{"code":"49","message":"ObjectIsRegistered"}}' - Status Code: 400 - Reason: 'Bad Request' - Headers: {'Content-Length': '71', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'OData-Version': '4.0'}

MariusWirtz commented 9 months ago

Some applications can not be updated but instead must be deleted and re-created.

It's not a bug in TM1py but a constraint of the TM1 REST API.