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
190 stars 109 forks source link

Is there a way to POST/PATCH/DELETE an application? #130

Closed macsir closed 4 years ago

macsir commented 5 years ago

I only see the function of read content from an application from your api? Do you know any example of POST/PATCH/DELETE?

cubewise-tryan commented 5 years ago

Hi @macsir,

Currently there is only a get method in the application service.

marfrit commented 5 years ago

I am looking at the API description and it looks like that there are no special API functions for applications. Is there another way to access them though?

MariusWirtz commented 5 years ago

Hi @marfrit,

here is a sample how to retrieve an application and store it as an xlsx file.

import configparser

from TM1py import TM1Service

config = configparser.ConfigParser()
config.read(r'..\config.ini')

with TM1Service(**config['tm1srv01']) as tm1:
    # path in TM1 Application-Tree
    path = 'Finance/P&L.xlsx'

    # get the application
    application = tm1.applications.get(path)

    # write it to xlsx file
    application.to_xlsx("out.xlsx")
tombrzy commented 5 years ago

I only see the function of read content from an application from your api? Do you know any example of POST/PATCH/DELETE?

HI @macsir, I created yesterday a pull request with the POST/DELETE methods. If Marius will accept it, then the functions will be available in master. PATCH is not supported by the REST API yet. Maybe IBM will introduce it in the future.

macsir commented 5 years ago

@tombrzy Hi, I figured out DELETE later but forgot to update here. Anyway, I will check out your codes. Thanks.

MariusWirtz commented 4 years ago

192 just got merged into the master branch.

It covers get, create, and delete operations for applications.