Loading TOC...

MarkLogic 10 Product Documentation
POST /manage/v2/databases/{id|name}/cpf-configs

Summary

This resource address creates a CPF configuration for the database.

URL Parameters
format The format of the request body. Can be either html, json, or xml (default). This value overrides the Accept header if both are present.
Request Headers
Accept The expected MIME type of the response. If the format parameter is present, it takes precedence over the Accept header.
Content-type The MIME type of the data in the response body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.
Response Headers
Content-type The MIME type of the data in the response body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.

Response

Upon success, MarkLogic Server returns status code 201 (Created). If the payload is malformed or the database does not exist, a status code of 400 (Bad Request) is returned. A status code of 401 (Unauthorized) is returned if the user does not have the necessary privileges.

Required Privileges

This operation requires the manage-user role, or the following privilege:

http://marklogic.com/xdmp/privileges/manage

http://marklogic.com/xdmp/privileges/manage-admin

Usage Notes

The request body takes the following form. The conversion-enabled boolean logically maps onto the conversion-enabled setting contained within domain configuration.

Note: The properties described here are for XML payloads. In general they are the same for JSON, with the exception that, in JSON, permissions is expressed in singular form. For example, in JSON, permissions is instead permission and the format is as shown in the example below.

domain-name

restart-user-name

eval-module

eval-root

conversion-enabled

permissions

The default set of permissions used in document creation.

This is a complex structure with the following children:

permission

Permission representation.

This is a complex structure with the following children:

role-name

The Role name (unique)

capability

The action/task permitted by a permission

Example


# load default pipelines (Status Change Handling & Flexible Replication)
# on the Triggers database.

curl -X POST --anyauth --user admin:admin --header \
"Content-Type:application/json" -d'{"operation":"load-default-cpf-pipelines"}' \
http://localhost:8002/manage/v2/databases/Triggers/pipelines?format=json

# create a CPF domain for Flexible Replication on the Triggers database.

cat domain_payload.json
==> 
{
    "domain-name": "myDomain",
    "description": "mydesc",
    "scope": "directory",
    "uri": "/",
    "depth": "infinity",
    "eval-module": "Modules",
    "eval-root": "/",
    "pipeline":["Status Change Handling","Flexible Replication"]
}

curl -X POST --anyauth --user admin:admin --header \
"Content-Type:application/json" -d@domain_payload.json \
http://localhost:8002/manage/v2/databases/Triggers/domains?format=json

# Install and configure CPF on the Triggers database.

cat setup-cpf.json
==> 
{
    "domain-name": "myDomain",
    "restart-user-name": "admin",
    "eval-module": "Modules",
    "eval-root": "/",
    "conversion-enabled": true,
    "permission": [{
        "role-name": "app-user",
        "capability": "read"
    }]
}'

curl -X POST  --anyauth --user admin:admin --header "Content-Type:application/json" \
-d@setup-cpf.json http://localhost:8002/manage/v2/databases/Triggers/cpf-configs?format=json


    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.