Create Essbase Script
/essbase/rest/v1/applications/{applicationName}/databases/{databaseName}/scripts
Creates the script in the specified application and database and returns the created script.
Request
- application/json
-
applicationName(required): string
Application name.
-
databaseName(required): string
Database name.
-
file: string
Type of script file.
Default Value:calc
Script details.
Response
200 Response
OK
Script created successfully, including script details and links to get, edit, or delete the script and to get its contents.
400 Response
Bad Request
Failed to create the script. The application or database name may be incorrect, the JSON for the script may be incorrect, or the specified script name may already exist.
415 Response
Not Acceptable
The media type isn't supported or wasn't specified.
500 Response
Internal Server Error.
Examples
The following examples shows how to create Essbase calculation scripts, MDX scripts, or report scripts using the REST API.
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
.
Create Calculation Script
call properties.bat
curl -X POST "https://myserver.example.com:9001/essbase/rest/v1/applications/Sample/databases/Basic/scripts?links=none" -H "accept: application/json" -H "Content-Type:application/json" -d '{"name": "EBudg", "content": "/* Calculate the Budget data values for the descendants of East */\r\n\r\nFIX(Budget, @DESCENDANTS(East))\r\n CALC DIM(Year, Measures, Product);\r\nENDFIX\r\n\r\n/* Consolidate East */\r\n\r\nFIX(Budget)\r\n @DESCENDANTS(East);\r\nENDFIX"}' -u %User%:%Password%
Example of Response Body
{
"name" : "EBudg",
"modifiedTime" : 1721688707444,
"sizeInBytes" : 224
}
Create MDX Script
call properties.bat
curl -X POST "https://myserver.example.com:9001/essbase/rest/v1/applications/Sample/databases/Basic/scripts?links=none&file=mdx" -H "accept: application/json" -H "Content-Type:application/json" -d '{"name": "mdx001", "content": "SELECT\r\n {[Year].[Qtr1], [Year].[Qtr2]} \r\nON COLUMNS,\r\n {\r\n BottomSum(\r\n [Product].Members, 10000, [Year].[Qtr1]\r\n ) \r\n }\r\nON ROWS\r\nFROM Sample.Basic\r\nWHERE ([Measures].[Sales])"}' -u %User%:%Password%
Example of Response Body
{
"name" : "mdx001",
"modifiedTime" : 1721690519590,
"sizeInBytes" : 183
}
Create Report Script
call properties.bat
curl -X POST "https://myserver.example.com:9001/essbase/rest/v1/applications/Sample/databases/Basic/scripts?links=none&file=report" -H "accept: application/json" -H "Content-Type:application/json" -d '{"name": "actsales", "content": "//Sample 1: Creating a Different Format for Each Page\r\n<PAGE (Accounts, Scenario, Product)\r\n // cube: demo.basic\r\n // script: actsales.rep\r\nSales\r\nActual\r\n<IDESCENDANTS Audio\r\n\r\n <COLUMN (Year)\r\n <CHILDREN Year\r\n\r\n<ROW(Market)\r\n<ICHILDREN Market\r\n ! \r\n"}' -u %User%:%Password%
Example of Response Body
{
"name" : "actsales",
"modifiedTime" : 1721690725392,
"sizeInBytes" : 264
}