1Create Data Security Rules
Overview
This API creates Data Security Rules for a Semantic Model. It allows you to define column-level restrictions and masking rules. The masking value must match the data type of the column. For example, numeric columns should be masked with a numeric value, date columns with a date value, and string columns with either a string or a regular expression.
Method: POST
Request URL: {kyvos-url}/rest/v2/semantic-models/data-security-rules
Authorization
API Key: sessionid
This method authenticates requests using a session ID which acts like an API key.
BasicAuth: HTTP Authorization Scheme
This method authenticates requests using a username and password sent in the HTTP Authorization header.
Headers
Header Name | Type | Description | Possible Values |
|---|---|---|---|
Content-Type (Required) | String | Specifies the media type of the request body. |
|
sessionid | String | The session ID is the token received from the login API. Note: Session ID is required for token-based authentication. | – |
Request Body
Parameter Name | Type | Description | Possible Values |
|---|---|---|---|
rulesJson (Required) | String | JSON string that defines column-level restrictions. Configure restrictions for individual columns by specifying objects in the Note: An example JSON is provided under the Resources section below. | – |
bulk | Boolean | Indicates whether the request should be processed as a bulk operation for creating or updating rules. |
Default: |
Responses
200 Success
{
"code": 0,
"message": "Successfully added semantic model object: Account Model"
}Status Code | Description |
|---|---|
401 | Authorization information is missing or invalid. |
404 | Connection, database, schema, or table not found. |
412 | Precondition failed. Required parameter is missing. |
500 | Internal Server Error |
Resources
Below is an example of JSON structure which can be used as a reference for the rulesJson parameter in the request body.
{
"semanticModelName":"account1",
"folderName":"Admin",
"ruleName":"Allow All Columns",
"description":"",
"dataSecurityRule":{
"rowLevelRule":[
{
"fieldName":"date",
"fieldType":"LEVEL",
"dimensionName":"RestAPI",
"restriction":"RESTRICT_DATA",
"operator":"INLIST",
"value":"6"
}
]
}
}