Cutover API
>
Examples
>
How to copy and start a runbook from a template

How to copy and start a runbook from a template

This example shows you how to create a runbook by copying an existing template and then how to start the runbook.

1. Create a runbook from a template

Let’s create a copy of the runbook titled Active Node Cluster Failure Recovery which has a runbook ID of 1118

This is done by making an authenticated call to the Create a New Runbook endpoint. We send a POST request with the following body:

{
 "data": {
   "type": "runbook",
   "attributes": {
     "name": "demo"
   }
 },
 "meta": {
   "copy": {
     "source_runbook_id": "1118",
     "tasks": true,
     "teams": true,
     "users": true
   },
   "shift_fixed_times": true
 }
}

In the example above, we have specified a name of “demo” and that we want to copy over ”tasks” , ”teams” and “users” from “source_ runbook_ ID”: "1118", which is the template we wish to create from.

The response from this endpoint will include the new runbook ID we have created. We can see from the image below that, in our example, the runbook ID is 19010.  

2. Start the runbook

Let’s start this runbook by calling the Start a Runbook endpoint . We can send a POST request with the following body:

{
 "meta": {
   "comms": "off",
   "run_type": "rehearsal",
   "rebaseline": true,
   "shift_fixed_times": true
 }
}

In our example request above we have set the following:
- comms to off, which means we cannot execute SMS, email or text task types.
- run_type to rehearsal.
- rebaseline to true to let us recalculate all planned task times based on the current time. 
- shift_fixed_times to true to shift any tasks or due dates relative to the current time.

Now, start the runbook by executing the API call.