Loading TOC...

POST /manage/v2/databases/{id|name}/pipelines

Summary

This resource address can be used to create and load CPF pipelines for the specified database.

URL Parameters
format The format of the posted data. 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 request body. If the format? parameter is present, it takes precedence over the Accept header.
Content-type The MIME type of the data in the request 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.
Location If the request causes a restart, a Location header is included in the reponse. The header contains a path with which to construct a URL to usable to test when the restart has completed.

Response

Upon success, MarkLogic Server returns status code 201 (Created). If the pipeline already exists or if the payload is malformed, 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-admin role, or the following privilege:

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

Usage Notes

Use the following operation to load the pipelines. This operation loads the pipelines from the /opt/MarkLogic/Installer directory. Reapplying this operation will effectively reinstall cpf pipelines from the current MarkLogic distribution, which is needed to upgrade pipelines.


{
  "operation": "load-default-cpf-pipelines"
}
    
The structure of the data in the request body to create a new pipeline is as follows.

annotation

Transition description

pipeline-id

A pipeline unique identifier.

pipeline-name

A pipeline name.

pipeline-description

A pipeline description.

success-action

success action

failure-action

failure action

status-transition

A transition defining what actions to take on create, update, or delete.

This is a complex structure with the following children:

annotation

Transition description

status

status

on-success

on-success

on-failure

on-failure

priority

priority

always

always

default-action

default-action

execute

A condition/action pair defining what to execute.

This is a complex structure with the following children:

annotation

Transition description

condition

condition

action

action

state-transition

A transition defining what actions to take on entry into a state.

This is a complex structure with the following children:

annotation

Transition description

state

state

on-success

on-success

on-failure

on-failure

priority

priority

always

always

default-action

default-action

execute

A condition/action pair defining what to execute.

This is a complex structure with the following children:

annotation

Transition description

condition

condition

action

action

event-transition

A transition defining what actions to take on a transition event.

This is a complex structure with the following children:

annotation

Transition description

event

event

priority

priority

default-action

default-action

execute

A condition/action pair defining what to execute.

This is a complex structure with the following children:

annotation

Transition description

condition

condition

action

action

Example


cat pipeline.json
==> 
{
  "pipeline-name": "Status Change Handling",
  "pipeline-description": "Out-of-the-box document status handling.",
  "success-action": {
    "module": "/MarkLogic/cpf/actions/success-action.xqy"
  },
  "failure-action": {
    "module": "/marklogic/cpf/actions/failure-action.xqy"
  },
  "status-transition": [
    {
      "annotation": "",
      "status": "created",
      "on-success": "http://marklogic.com/states/initial",
      "priority": 100,
      "default-action": {
        "module": "/marklogic/cpf/actions/set-updated-action.xqy"
      },
      "execute": [
        {
          "condition": {
            "module": "/marklogic/cpf/actions/changed-type-condition.xqy"
          },
          "action": {
            "module": "/marklogic/cpf/actions/success-action.xqy"
          }
        },
        {
          "condition": {
            "module": "/MarkLogic/cpf/actions/renamed-links-condition.xqy"
          },
          "action": {
            "module": "/MarkLogic/cpf/actions/link-rename-action.xqy"
          }
        },
        {
          "condition": {
            "module": "/MarkLogic/cpf/actions/existing-state-condition.xqy"
          },
          "action": {
            "module": "/MarkLogic/cpf/actions/touch-state-action.xqy"
          }
        }
      ]
    }
  ]
}

curl -X POST --anyauth --user admin:admin \
--header "Content-Type:application/json" -d@pipeline.json \
http://localhost:8002/manage/v2/databases/Triggers/pipelines?format=json
 
==> Creates a new pipeline, named "Status Change Handling," in the Triggers
    database.
    

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy