9.5. Quick Reference¶
9.5.1. Playbook CRUD¶
Quick reference for creating, reading, updating, and deleting playbooks. Examples provided for both JSON and YAML input/outputs.
Assume the following:
- A playbook not uploaded yet in JSON format: pb.json
- A playbook not uploaded yet in YAML format: pb.yaml
- The ID of an already uploaded playbook: 54219f1702b67c666dde3a7d
- Authentication is required
- We are a member of the group called: crudtest
- Our re-rest base endpoint is http://rerest.example.com/api/v0/
9.5.1.1. Create¶
JSON
$ curl -X PUT -u $USER --data @pb.json -H "Content-Type: application/json" http://rerest.example.com/api/v0/crudtest/playbook/
YAML
$ curl -X PUT -u $USER --data-binary @pb.yaml -H "Content-Type: application/yaml" http://rerest.example.com/api/v0/crudtest/playbook/?format=yaml
9.5.1.2. Read¶
Note
The READ (GET) operations do not require explicitly setting the Content-Type header.
JSON
# Get a single playbook from the 'crudtest' group collection
$ curl -X GET -u $USER http://rerest.example.com/api/v0/crudtest/playbook/54219f1702b67c666dde3a7d/
# Get ALL playbooks for the 'crudtest' group collection in JSON format
$ curl -X GET -u $USER http://rerest.example.com/api/v0/test/playbook/
YAML
# Get a single playbook from the 'crudtest' group collection
$ curl -X GET -u $USER http://rerest.example.com/api/v0/crudtest/playbook/54219f1702b67c666dde3a7d/?format=yaml
# Get ALL playbooks for the 'crudtest' group collection in YAML format
$ curl -X GET -u $USER http://rerest.example.com/api/v0/test/playbook/?format=yaml
9.5.1.3. Update¶
JSON
$ curl -X POST -u $USER -H "Content-Type: application/json" --data @pb.json http://rerest.example.com/api/v0/crudtest/playbook/54219f1702b67c666dde3a7d/
YAML
$ curl -X POST -u $USER -H "Content-Type: application/yaml" --data-binary @pb.yaml http://rerest.example.com/api/v0/crudtest/playbook/54219f1702b67c666dde3a7d/?format=yaml
9.5.1.4. Delete¶
Note
The DELETE action is JSON/YAML agnostic.
$ curl -X DELETE -u $USER http://rerest.example.com/api/v0/crudtest/playbook/54219f1702b67c666dde3a7d/
9.5.2. Deployments¶
Quick reference for deployment commands.
Assume:
- A playbook exists with ID 54219f1702b67c666dde3a7d
- Our re-rest base endpoint is http://rerest.example.com/api/v0/
- We are a member of the group called: test
9.5.2.1. Start (No dynamic args)¶
Example of how to start a deployment which requires no dynamic arguments and authentication is required.
1 2 3 4 5 | $ curl -v -X PUT -u $USER -H "Content-Type: application/json" https://rerest.example.com/api/v0/test/playbook/54219f1702b67c666dde3a7d/deployment/
{
"id": "542ac6607d4b6d00153b6db5",
"status": "created"
}
|
Our deployment ID is on line 3: 542ac6607d4b6d00153b6db5
9.5.2.2. Start (With dynamic args)¶
Example of how to start a deployment which requires dynamic arguments and authentication is required.
1 2 3 4 5 | curl -v -X PUT -u $USER -d '{"environment": "qa", "change_record": "CHG0002025"}' -H "Content-Type: application/json" https://rerest.example.com/api/v0/test/playbook/54219f1702b67c666dde3a7d/deployment/
{
"id": "542ac6607d4b6d00153b6db6",
"status": "created"
}
|
Our deployment ID is on line 3: 542ac6607d4b6d00153b6db6