Create Policy

Creates policies or policy types.

The Policy Management APIs provide an abstracted layer on top of entity extraction, categorization, and related functionality to allow the definition of policies for the management of information.Classifications can be created to group documents and other objects into collections. Policies enact actions upon documents associated with a collection such as indexing.

Classification involves sorting documents into Collections; all documents in a collection share some common criteria, identified using Conditions.

The collection or collections that a document matches can influence how it is indexed and determine policies that are executed against it.

The Create Policy API allows policy objects to be created.

Quick Start

To create a policy object, you must specify a policy object name, type, and supply additional parameters in additional.

For example:

/1/api/[async|sync]/createpolicyobjects/v1?name=policy1&type=policy

The name can be any value that allows you to identify the policy object.

The following policy object types can be created:

  • policy. A policy is created.
  • policy_type. A policy type is defined.

The additional parameter takes a JSON object specifying additional parameters that can be provided for the policy object type.

Policy

An example of the required format for additional JSON for a policy is:

{
    "policy_type_id": 1,
    "priority": 0,
    "details": {
        "fieldActions": [
            {
                "action": "ADD_FIELD_VALUE",
                "name": "FLAGGED",
                "value": "TRUE"
            }
        ],
        "idolIndexAction": "FULL"
    }
}

The policy_type_id field is mandatory, identifying the type of policy being created. Valid values are:

1 – Indexing policy

The priority field is mandatory. It contains the priority of the policy which is used when resolving policy conflicts.

The details field is mandatory. It provides information for the policy being created.

Policy Type

An example of the required format for additional JSON for a policy type is:

The definition field is mandatory. It contains the JSON definition for a given policy type, and how to validate a policy created of that type.

The short_name field is mandatory. It provides the unique information required to reference this particular policy type.

{
    "definition": {
        "title": "Indexing Policy Type",
        "description": "An indexing policy.",
        "type": "object",
        "properties": {
            "idolIndexAction": {
                "enum": [
                    "FULL",
                    "NONE"
                ],
                "type": "string"
            },
            "fieldActions": {
                "items": {
                    "properties": {
                        "action": {
                            "description": "The type of action to perform on the field.",
                            "enum": [
                                "ADD_FIELD_VALUE"
                            ],
                            "type": "string"
                        },
                        "name": {
                            "description": "The name of the field to perform the action on.",
                            "minLength": 1,
                            "type": "string"
                        },
                        "value": {
                            "description": "The value to use for the field action.",
                            "type": "string"
                        }
                    },
                    "required": [
                        "name",
                        "action"
                    ],
                    "title": "Field Action",
                    "type": "object"
                },
                "type": "array"
            }
        },
        "required": [
            "idolIndexAction"
        ]
    },
    "short_name": "test-indexing-policy"
}
Synchronous
https://api.havenondemand.com/1/api/sync/createpolicyobjects/v1
Asynchronous
https://api.havenondemand.com/1/api/async/createpolicyobjects/v1
Authentication

This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.
Parameters

This API accepts the following parameters:

Required
Name Type Description
name
string The name of the policy object to create.
type
enum The type of policy object to create.
additional
json Specify a JSON object of additional parameters relevant for the type of policy object being created.
Optional
Name Type Description
description
string A description for the policy object to create.
Enumeration Types

This API's parameters use the enumerations described below:

type
The type of policy object to create.
policy Policy
A policy object of type policy.
policy_type Policy Type
A policy object of type policy_type.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

Model
This is an abstract definition of the response that describes each of the properties that might be returned.
Create Policy Response {
additional ( object , optional) A JSON object of additional parameters relevant for the type of policy object.
description ( , optional) The description of the policy object.
id ( number , optional) The ID of the policy object.
name ( string , optional) The name of the policy object.
type ( enum<Type> , optional) The type of policy object.
}
enum<Create Policy Response:Type> {
'policy' , 'policy_type'
}
Model Schema
This is a JSON schema that describes the syntax of the response. See json-schema.org for a complete reference.
{
    "properties": {
        "additional": {
            "type": "object"
        },
        "id": {
            "multipleOf": 1,
            "type": "number"
        },
        "name": {
            "minLength": 1,
            "type": "string"
        },
        "type": {
            "enum": [
                "policy",
                "policy_type"
            ]
        }
    },
    "type": "object"
}


If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.