Apache Ranger Public REST APIs
Also available as:
PDF

Create Service Definition

Reference information for the Ranger REST API service/public/v2/api/servicedef.

API Name Create Service Definition
Request Type Post
Request URL service/public/v2/api/servicedef
Request Params
{
    "accessTypes": [
        {
            "impliedGrants": [],
            "itemId": 1,
            "label": "select",
            "name": "select"
        },
        {
            "impliedGrants": [],
            "itemId": 2,
            "label": "update",
            "name": "update"
        },
        {
            "impliedGrants": [],
            "itemId": 3,
            "label": "Create",
            "name": "create"
        },
        {
            "impliedGrants": [],
            "itemId": 4,
            "label": "Drop",
            "name": "drop"
        },
        {
            "impliedGrants": [
                "select",
                "update",
                "create",
                "drop"
            ],
            "itemId": 5,
            "label": "All",
            "name": "all"
        }
    ],
    "configs": [
        {
            "itemId": 1,
            "label": "Username",
            "mandatory": true,
            "name": "username",
            "type": "string",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        },
        {
            "itemId": 2,
            "label": "Password",
            "mandatory": true,
            "name": "password",
            "type": "password",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        }
    ],
    "contextEnrichers": [],
    "description": "Test Component",
    "enums": [],
    "implClass": "org.apache.ranger.services.test.RangerServiceTest",
    "isEnabled": true,
    "label": "Test Component",
    "name": "test",
    "options": {},
    "policyConditions": [],
    "resources": [
        {
            "description": "Root Of Resource Hierarchy for Test Component",
            "excludesSupported": true,
            "itemId": 1,
            "label": "Test Root Resource",
            "level": 10,
            "lookupSupported": true,
            "mandatory": true,
            "matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
            "matcherOptions": {
                "ignoreCase": "true",
                "wildCard": "true"
            },
            "name": "root",
            "recursiveSupported": false,
            "type": "string",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        },
        {
            "description": "Sub Resource for Test Component",
            "excludesSupported": true,
            "itemId": 2,
            "label": "Test sub resource",
            "level": 20,
            "lookupSupported": true,
            "mandatory": true,
            "matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
            "matcherOptions": {
                "ignoreCase": "true",
                "wildCard": "true"
            },
            "name": "sub",
            "parent": "root",
            "recursiveSupported": false,
            "type": "string",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        }
    ],
    "version": 1
}
Response
{
    "accessTypes": [
        {
            "impliedGrants": [],
            "itemId": 1,
            "label": "select",
            "name": "select"
        },
        {
            "impliedGrants": [],
            "itemId": 2,
            "label": "update",
            "name": "update"
        },
        {
            "impliedGrants": [],
            "itemId": 3,
            "label": "Create",
            "name": "create"
        },
        {
            "impliedGrants": [],
            "itemId": 4,
            "label": "Drop",
            "name": "drop"
        },
        {
            "impliedGrants": [
                "select",
                "update",
                "create",
                "drop"
            ],
            "itemId": 5,
            "label": "All",
            "name": "all"
        }
    ],
    "configs": [
        {
            "itemId": 1,
            "label": "Username",
            "mandatory": true,
            "name": "username",
            "type": "string",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        },
        {
            "itemId": 2,
            "label": "Password",
            "mandatory": true,
            "name": "password",
            "type": "password",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        }
    ],
    "contextEnrichers": [],
    "createTime": 1451347300617,
    "createdBy": "Admin",
    "description": "Test Component",
    "enums": [],
    "guid": "f889f2d3-920a-4504-9905-809bbc417902",
    "id": 101,
    "implClass": "org.apache.ranger.services.test.RangerServiceTest",
    "isEnabled": true,
    "label": "Test Component",
    "name": "test",
    "options": {},
    "policyConditions": [],
    "resources": [
        {
            "description": "Root Of Resource Hierarchy for Test Component",
            "excludesSupported": true,
            "itemId": 1,
            "label": "Test Root Resource",
            "level": 10,
            "lookupSupported": true,
            "mandatory": true,
            "matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
            "matcherOptions": {
                "ignoreCase": "true",
                "wildCard": "true"
            },
            "name": "root",
            "recursiveSupported": false,
            "type": "string",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        },
        {
            "description": "Sub Resource for Test Component",
            "excludesSupported": true,
            "itemId": 2,
            "label": "Test sub resource",
            "level": 20,
            "lookupSupported": true,
            "mandatory": true,
            "matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
            "matcherOptions": {
                "ignoreCase": "true",
                "wildCard": "true"
            },
            "name": "sub",
            "parent": "root",
            "recursiveSupported": false,
            "type": "string",
            "uiHint": "",
            "validationMessage": "",
            "validationRegEx": ""
        }
    ],
    "updateTime": 1451347300618,
    "updatedBy": "Admin",
    "version": 1
}