Docs »

API »

Endpoints »

Packages

Import a package

POST /packages/import.json

Import a pre-built workflow package. You must have administrator privileges to make this request.

Field Type  
package_json string See: Packages
prompts[] array (varies by package)

Example



$json_string = <<< EOF
{
  "package": {
    "name": "Create a task",
    "revision": 1,
    "requires": {
      "cerb_version": "9.1.4",
      "plugins": [
        "cerb.bots.portal.widget"
      ]
    },
    "configure": {
      "prompts": [
        {
          "type": "text",
          "label": "Task name:",
          "key": "task_title",
          "params": {
          }
        },
        {
          "type": "chooser",
          "label": "Task owner:",
          "key": "worker_id",
          "params": {
            "context": "cerberusweb.contexts.worker",
            "query": "isDisabled:n",
            "single": true
          }
        }
      ]
    }
  },
  "records": [
    {
      "_context": "task",
      "uid": "new_task",
      "title": "{{{task_title}}}",
      "owner_id": "{{{worker_id}}}"
    }
  ]
}

EOF;

$postfields = [
    ['package_json', $json_string],
    ['prompts[task_title]', 'This is a new task']
    ['prompts[worker_id]', '1']
];
$out = $cerb->post($base_url . 'packages/import.json', $postfields);