1

I'm working with IBM Cognos Tm1 REST API. I need subset of the data values contained in a cube (Cube1 for example).

So, I'm executing a view (View1 for example) and obtain a cellset.

http://server:port/api/v1/Cubes('Cube1')/Views('View1')/tm1.execute?$expand=Cells($select=Ordinal,FormattedValue,Consolidated) 

However, I obtain much more cell values than I need. My questions are:

  • Can I create my own view via REST API only? (And how?)
  • Can I ask API to return only not consolidated values?
  • Can I obtain cell value in some other way, without views?
Michail L
  • 37
  • 1
  • 4
  • The REST API documentation says you can create an entity (a view is an entity) using post: http://www.ibm.com/support/knowledgecenter/api/content/SS9RXT_10.2.2/com.ibm.swg.ba.cognos.tm1_rest_api.10.2.2.doc/dg_tm1_odata_common_ops.html#dg_tm1_odata_create_entity?locale=en. So yes yoo can create a view but I don't know the exact syntax. There are other API's besides the rest API - does it have to be REST? – Nick.Mc Apr 18 '16 at 10:43
  • The best approach would be to pre-create the view in the Tm1 thick client designer tool. The view should be built to not return consolidated values - do all that first then just use the REST API to read from the view. You can use any one of the different API's (i.e. Excel add in) to read cell values. What exactly are you trying to do? – Nick.Mc Apr 18 '16 at 10:45
  • 2.I am trying to load data from Tm1 Cube to Java, solve problem based on this data and then return data back. 1.No, it doesn't have to be REST API (but it has to be Java). Solution with pre-creating views works fine, but seems inconvenient to me. I need large number of such views, so I want to be able to create and delete views dynamically via API. – Michail L Apr 18 '16 at 13:26
  • This page indicates there is a java specific API: https://www.ibm.com/support/knowledgecenter/SS9RXT_10.2.2/com.ibm.swg.ba.cognos.tm1_inst.10.2.2.doc/t_tm1_inst_installing_api_component.html. Anyway sorry I can't help further - the answer is hopefully in the API documentation – Nick.Mc Apr 18 '16 at 22:48
  • You can definitely execute MDX over the traditional Java API. I am not sure whether this also applies to the REST API (don't remember). Could you simply construct MDX to return the desired view via your API call? – aTotalStranger May 07 '16 at 00:53

2 Answers2

1

Try creating a view via ExecuteMDX

Post Query: api/v1/ExecuteMDX?$expand=Axes($expand=Hierarchies($select=Name),Tuples($expand=Members($select=Name))),Cells($select=Ordinal,Value)

And then in the Body

{
"MDX": "SELECT 
SELECT {[Version].[Actual]}* 
{[Year].[2017]} * 
{[Location]. [1001]}* 
{[Period].[Total Year]} * 
{[Currency].[USD]} *
[Department].[Total Department]} * 
{[Product Type].[Total Product Type]} * 
{TM1FILTERBYLEVEL({TM1SUBSETALL( [Account] )}, 0)} 
{[Cube1 Measure].[Amount]} ON 0 FROM [Cube1]"
}

Good Luck!

0

You create dynamic views using TM1 Java APIs. You can find detailed documentation in \tm1_64\TM1JavaApiDocs\

or by default its

C:\Program Files\ibm\cognos\tm1_64\TM1JavaApiDocs

and sample codes are located in C:\Program Files\ibm\cognos\tm1_64\tm1api\samplecode\java

Hope this helps you.