0

I am trying to find a way to make a Rest API call to TM1 that sends it an array of data to be updated in the Cube. The data to be updated will be identifiable by the Cube's key but it wont be all the records to be update (e.g. update row 3 and 5 with new values).

I am having issue finding an example. I did see from documentation "Cube.UpdateCells" But didnt see example on how to use it. I also saw https://www.ibm.com/support/knowledgecenter/SS9RXT_10.2.2/com.ibm.swg.ba.cognos.tm1_rest_api.10.2.2.doc/t_tm1_rest_api_cellsets.html#dg_tm1_odata_update_many_cell_values where it mentions updating many cells but no example..

I didn't find anything here about it so any help would be appreciated!

1 Answers1

0

You should try the tm1.Update function and write the exact crossing in the cube. the URL will look like this one ; https://myserver:myportnumber/api/v1/Cubes('mycube')/tm1.Update and in the body of your POST Request you'll puch the exact crossing of your cube with the value. it will look like this one:

{
    "Cells":[
        {"Tuple@odata.bind": [
            "Dimensions('Version')/Hierarchies('Version')/Elements('BUDGET')",
            "Dimensions('Societe')/Hierarchies('Societe')/Elements('S01')",
            "Dimensions('Compte')/Hierarchies('Compte')/Elements('C7090')",
            "Dimensions('Annee')/Hierarchies('Annee')/Elements('2019')",
            "Dimensions('Mois')/Hierarchies('Mois')/Elements('M01')",
            "Dimensions('m_Couts')/Hierarchies('m_Couts')/Elements('MONTANT')"
            ]
        }
    ],
    "Value":"1234"
}

You can learn more about the TM1 REST API here : https://code.cubewise.com/tm1-rest-api

You'll have a lot of explanation. Try their Postman Collection for the TM1 REST API you'll learn a lot. You just have to install POSTMAN on your laptop and try it on the IBM samples servers.

In general Cubewise as a lot of good tools. To go further if you know Python or you want to learn it you have the TM1Py library wich is good to work with the TM1 REST API

Wuzardor
  • 119
  • 1
  • 10
  • Thanks for the response. For the example above is it possible to have multiple sets like: { "Cells":[ {"Tuple@odata.bind": [ "Dimensions('Version')/Hierarchies('Version')/Elements('BUDGET')", ] } ], "Value":"1234", "Cells":[ {"Tuple@odata.bind": [ "Dimensions('m_Couts')/Hierarchies('m_Couts')/Elements('MON')" ] } ], "Value":"13334" }? Also, can i represent the data in Java format? would it be an entity? – user3822558 Aug 25 '20 at 15:44
  • Yes, if its for the same cube it's OK. What you mean by Java format ? a Java Entity? its only allows json format. if you write code i don't think it will work because you're sending a post request to the API. – Wuzardor Aug 26 '20 at 20:20
  • You can create your java entity to generate your json an send your post request after in your script. – Wuzardor Aug 26 '20 at 20:26