Preview Rules Data

post

/utils/rules/preview

Applies a rule file to a two-dimensional array of data and returns a previewed data load as two-dimensional array.

Request

There are no request parameters for this operation.

Back to Top

Response

200 Response

OK

Data through rule file was previewed successfully.

400 Response

Bad Request

Failed to preview this data through this rule file.

500 Response

Internal Server Error.

Back to Top

Examples

The following example shows how to preview a data load or dimension build rule file definition.

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.

Preview: Add Members as Siblings of the Lowest Level

Script with cURL Commands

The following script previews a dimension-build rule for Sample Basic. The rule is designed to add new members (A100-10 and A100-99) to the Measures dimension, using the build type SIBLING_LOWEST_LEVEL.

call properties.bat
curl -X POST https://myserver.example.com:9001/essbase/rest/v1/utils/rules/preview -H "Accept:application/json" -H "Content-Type:application/json" --data "@./siblow.json"-u %User%:%Password%

Sample JSON Payload

The cURL example above delivers the following JSON payload in siblow.json to preview the rule. The payload consists of an array of data records, followed by a working definition for a load rule not created yet.

{
	"data": [
		[
			"100-10",
			"Texas",
			"A100-10",
			"",
			"100",
			"120",
			"100"
		],
		[
			"200-20",
			"Texas",
			"A100-99",
			"",
			"111",
			"154",
			"180"
		]
	],
	"rules": {
		"columnOperations": [],
		"fields": [
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Measures",
					"generation": -1,
					"ignore": true,
					"refer": 0
				},
				"field": 0,
				"trim": true,
				"type": "SIBLING_LOWEST_LEVEL"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Measures",
					"generation": -1,
					"ignore": true,
					"refer": 0
				},
				"field": 1,
				"trim": true,
				"type": "SIBLING_LOWEST_LEVEL"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Measures",
					"generation": -1,
					"refer": 0
				},
				"field": 2,
				"trim": true,
				"type": "SIBLING_LOWEST_LEVEL"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Measures",
					"generation": -1,
					"ignore": true,
					"refer": 0
				},
				"field": 3,
				"trim": true,
				"type": "SIBLING_LOWEST_LEVEL"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Measures",
					"generation": -1,
					"ignore": true,
					"refer": 0
				},
				"field": 4,
				"trim": true,
				"type": "SIBLING_LOWEST_LEVEL"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Measures",
					"generation": -1,
					"ignore": true,
					"refer": 0
				},
				"field": 5,
				"trim": true,
				"type": "SIBLING_LOWEST_LEVEL"
			}
		]
	}
}

Sample JSON Response

The REST API returns the following preview.

{
  "data" : [ [ "100-10", "Texas", "A100-10", "", "100", "120" ], [ "200-20", "Texas", "A100-99", "", "111", "154" ] ]
}

Preview: Add Members and Attribute Associations

Script with cURL Commands

The following script previews a dimension-build rule for Sample Basic. The rule is designed to add new members (500, 500-10, and 500-20) to the Product dimension, add a numeric attribute member (64) to the Ounces dimension, and make attribute-to-base-member associatons.

call properties.bat
curl -X POST https://myserver.example.com:9001/essbase/rest/v1/utils/rules/preview -H "Accept:application/json" -H "Content-Type:application/json" --data "@./attrprod.json"-u %User%:%Password%

Sample JSON Payload

The cURL example above delivers the following JSON payload in attrprod.json to preview the rule. The payload consists of an array of data records, followed by a working definition for a load rule not created yet.

{
	"data": [
		[
			"500",
			"500-10",
			"64",
			"True"
		],
		[
			"500",
			"500-20",
			"64",
			"False"
		]
	],
	"rules": {
		"columnOperations": [],
		"fields": [
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Product",
					"generation": 2,
					"generationType": "GENERATION",
					"refer": 0
				},
				"field": 0,
				"fieldWidth": 13.625,
				"generationOrLevelName": "",
				"generationOrLevelUnique": false,
				"trim": true,
				"type": "GENERATION"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "",
					"dimension": "Product",
					"generation": 3,
					"generationType": "GENERATION",
					"refer": 0
				},
				"field": 1,
				"fieldWidth": 13.125,
				"generationOrLevelName": "",
				"generationOrLevelUnique": false,
				"trim": true,
				"type": "GENERATION"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "Ounces",
					"dimension": "Product",
					"generation": 3,
					"generationType": "ATTRIBUTE_MEMBER",
					"refer": 0
				},
				"field": 2,
				"fieldWidth": 16.375,
				"trim": true,
				"type": "GENERATION"
			},
			{
				"dimensionBuildOptions": {
					"attributeDimension": "Caffeinated",
					"dimension": "Product",
					"generation": 3,
					"generationType": "ATTRIBUTE_MEMBER",
					"refer": 0
				},
				"field": 3,
				"fieldWidth": 24.125,
				"trim": true,
				"type": "GENERATION"
			}
		]
	}
}

Sample JSON Response

The REST API returns the following preview.

{
  "data" : [ [ "500", "500-10", "64", "True" ], [ "500", "500-20", "64", "False" ] ]
}
Back to Top