Create Application Datasource

post

/applications/{applicationName}/datasources

Creates an application-level datasource based on specified inputs. name, connection, and type are required inputs for all types of Datasource. Other required inputs differ based on the type of Datasource.

Request

Path Parameters
Back to Top

Response

200 Response

OK

Datasource created successfully.

400 Response

Bad Request

Failed to create Datasource.

Back to Top

Examples

The following example shows how to create an application-level Datasource.

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.

Script with cURL Command

curl -X POST "https://myserver.example.com:9001/essbase/rest/v1/applications/Sample/datasources" -H Accept:application/json -H Content-Type:application/json --data "@./app_DS_create.json" -u %User%:%Password%

Sample JSON Payload - Oracle Database

The cURL example above delivers the following JSON payload in app_DS_create.json.

This sample Datasource includes runtime parameter in its query. The runtime parameter is set up to use an Essbase substitution variable to filter the Oracle Database source records based on the current month.

{
  "name" : "OracleDB_DS",
  "description" : "Datasource for ORCL current month only",
  "connection" : "Sample.OracleDB",
  "type" : "DB",
  "columns" : {
    "Column" : [ {
      "name" : "DIMENSION_PRODUCT",
      "type" : "STRING",
      "index" : 1,
      "system" : false
    }, {
      "name" : "DIMENSION_MARKET",
      "type" : "STRING",
      "index" : 2,
      "system" : false
    }, {
      "name" : "DIMENSION_YEAR",
      "type" : "STRING",
      "index" : 3,
      "system" : false
    }, {
      "name" : "DIMENSION_SCENARIO",
      "type" : "STRING",
      "index" : 4,
      "system" : false
    }, {
      "name" : "SALES",
      "type" : "DOUBLE",
      "index" : 5,
      "system" : false
    }, {
      "name" : "COGS",
      "type" : "DOUBLE",
      "index" : 6,
      "system" : false
    }, {
      "name" : "MARKETING",
      "type" : "DOUBLE",
      "index" : 7,
      "system" : false
    }, {
      "name" : "PAYROLL",
      "type" : "DOUBLE",
      "index" : 8,
      "system" : false
    }, {
      "name" : "MISC",
      "type" : "DOUBLE",
      "index" : 9,
      "system" : false
    }, {
      "name" : "INITIAL_INVENTORY",
      "type" : "DOUBLE",
      "index" : 10,
      "system" : false
    }, {
      "name" : "ADDITIONS",
      "type" : "DOUBLE",
      "index" : 11,
      "system" : false
    } ]
  },
  "query" : "select * from SB_DATA where dimension_year=?",
  "queryParameters" : [ {
    "index" : 1,
    "name" : "Param1",
    "required" : false,
    "useSubVariable" : true,
    "subVariableName" : "CurrMonth",
    "type" : "STRING"
  } ]
}

For examples of Datasources created for Essbase cubes, Excel workbooks, or flat file sources, see the Create Global Datasource endpoint. The JSON payload specifications are similar.

Back to Top