Run MDX Report
/essbase/rest/v1/applications/{application}/databases/{database}/mdx/{name}
Runs an MDX report, returning the results in the selected format (JSON, HTML, Excel, or CSV). An MDX report is saved in the cube context.
See also:
Request
-
application(required): string
Application name.
-
database(required): string
Database name.
-
name(required): string
MDX report name.
-
format: string
Result format.
Default Value:JSON
Allowed Values:[ "XLSX", "CSV", "HTML", "JSON" ]
Response
- application/octet-stream
200 Response
Mostly OK
As this is a streaming API, it can fail even with status 200. Check for an errorMessage
tag in the response to identify any errors.
object
400 Response
Bad Request
Failed to get the data in the required format.
500 Response
Internal Server Error.
Examples
The following example shows how to get the results of a named MDX report (this is not the same as an MDX script).
This example uses cURL to access the REST API from a Windows shell script. The calling user's ID and password are variables whose values are set in properties.bat
.
For this example, assume there is a named MDX report, mdxreport01, that is associated with Sample Basic. The query of the report is:
SELECT
{[Year].[Qtr1], [Year].[Qtr2]}
ON COLUMNS,
{
BottomSum(
[Product].Members, 10000, [Year].[Qtr1]
)
}
ON ROWS
FROM Sample.Basic
WHERE ([Measures].[Sales])
Script with cURL Command
The following script gets the results of the MDX report and writes them to a file.
call properties.bat
curl -X GET https://myserver.example.com:9001/essbase/rest/v1/applications/Sample/databases/Basic/mdx/mdxreport01 -H "Accept:application/octet-stream" -H "Content-Type:application/json" -o mdxout.json -u %User%:%Password%
Example of Response Body
The following JSON results are written to mdxout.json
.
{ "metadata" : {"page" : ["Measures","Market","Scenario"],"column" : ["Year"],"row" : ["Product"]},"data" : [["","Qtr1","Qtr2"],["200-40","2807.0","2922.0"],["100-30","3187.0","3182.0"],["400-30","3763.0","3962.0"],["300-20","4248.0","4638.0"]] }
Example using Execute As
If you are a Service Administrator, you can use Execute As to impersonate other users and check their data access. This can be useful for testing filters assigned to various users.
To do so, add a request header X-Essbase-LoginAs
with a user name who is provisioned to the application.
For example, the following script writes to a file the results of an MDX report "as executed by" (using the permissions viewpoint of) user3.
call properties.bat
curl -X GET https://myserver.example.com:9001/essbase/rest/v1/applications/Sample/databases/Basic/mdx/mdxreport02 -H "Content-Type:application/json" -H 'X-Essbase-LoginAs: user3' -o mdxout2.json -u %User%:%Password%