Page 2 of 2

Re: View Extract with TM1 API

Posted: Fri Nov 03, 2017 11:28 am
by ture
Super! I can see that it works! Thank You!

I have last problem. When I use API for c/c++/basic and want to extract a content through my new MDX-view from this cube, I upload all content of cube.

For example:

Code: Select all

//cube by name
TM1V hCube = TM1ObjectListHandleByNameGet(hPool, hServer, TM1ServerCubes()       , TM1ValString(hPool, "}ClientGroups" , 0));
//view by name
TM1V hView = TM1ObjectListHandleByNameGet(hPool, hCube  , TM1ValIndex(hPool, 357), TM1ValString(hPool, "mdx_View_last9", 0));
				
//extract data from view
TM1V hExtractList = TM1ViewExtractCreate(hPool, hView);
TM1V hExtract = nullptr;
					
while (nullptr != (hExtract = TM1ViewExtractGetNext(hPool, hExtractList))) {
	if (TM1ValType(hUser, hExtract) == TM1ValTypeError()) 
		std::cerr << "Oops\n";
					
	TM1_INDEX ind = TM1ValType(hUser, hExtract);
	if (ind == TM1ValTypeIndex()) {
		TM1_INDEX n = TM1ValIndexGet(hUser, hExtract);
		if (n > 0) 
			std::cout << n << std::endl;
		else
			break;
	}else if (ind == TM1ValTypeString()) 
		std::cout << TM1ValStringGet(hUser, hExtract) << std::endl;
	else if (ind == TM1ValTypeReal()) 
		std::cout << TM1ValRealGet(hUser, hExtract) << std::endl;
	else
		std::cerr << "Oops 2\n";
}
But through Rest API it works fine:

Code: Select all

https://as-msk-a0134:8000/api/v1/Cubes('}ClientGroups')/Views('mdx_View_last9')/tm1.Execute?$expand=Cube($select=Name;$expand=Dimensions($select=Name)),Axes($expand=Tuples($expand=Members($select=Name;$expand=Element($select=UniqueName)))),Cells
with headers certainly.

How can I extract data through mdx-view correctly using API c/++/basic?

Re: View Extract with TM1 API

Posted: Fri Nov 03, 2017 12:15 pm
by Wim Gielis
ture wrote: Fri Nov 03, 2017 11:28 amBut through Rest API it works fine:

Code: Select all

https://as-msk-a0134:8000/api/v1/Cubes('}ClientGroups')/Views('mdx_View_last9')/tm1.Execute?$expand=Cube($select=Name;$expand=Dimensions($select=Name)),Axes($expand=Tuples($expand=Members($select=Name;$expand=Element($select=UniqueName)))),Cells
with headers certainly.
Hi,

Just a question. I changed the URL to:

Code: Select all

http://localhost:8000/api/v1/Cubes('CPI')/Views('a')/tm1.Execute?$expand=Cube($select=Name;$expand=Dimensions($select=Name)),Axes($expand=Tuples($expand=Members($select=Name;$expand=Element($select=UniqueName)))),Cells
What does it mean if I receive in the browser (Chrome):

{"error":{"code":"278","message":"GET not supported on this resource!"}}

8000 is correct, so is cube CPI and view a.

Other statements with the REST API are fine.
Trying to increase my knowledge in this area :-)

Re: View Extract with TM1 API

Posted: Fri Nov 03, 2017 1:29 pm
by ture
Hi,

Just a question. I changed the URL to:

Code: Select all

http://localhost:8000/api/v1/Cubes('CPI')/Views('a')/tm1.Execute?$expand=Cube($select=Name;$expand=Dimensions($select=Name)),Axes($expand=Tuples($expand=Members($select=Name;$expand=Element($select=UniqueName)))),Cells
What does it mean if I receive in the browser (Chrome):

{"error":{"code":"278","message":"GET not supported on this resource!"}}

8000 is correct, so is cube CPI and view a.



Other statements with the REST API are fine.
Trying to increase my knowledge in this area :-)
[/quote]

You need use "Postman" https://chrome.google.com/webstore/deta ... bncdddomop

Make POST to this URL.

Re: View Extract with TM1 API

Posted: Tue Nov 28, 2017 9:49 am
by Drg
Use POST method.