Create vCenter VS Snapshot

To create a vCenter virtual server snapshot, use the following request:

1
2
POST /virtual_machines/:virtual_machine_id/snapshots.xml
POST /virtual_machines/:virtual_machine_id/snapshots.json

XML Request Example

1
curl -i -X POST -u user_email:api_key --url http://onapp.test/virtual_machines/44/snapshots.xml -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<name>test</name>'

JSON Request Example

1
curl -i -X POST -u user_email:api_key --url http://onapp.test/virtual_machines/44/snapshots.json -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"name": "test"}'

XML Output Example

1
2
3
4
5
6
7
8
9
<virtual_machine_snapshot>
  <id>7</id>
  <virtual_machine_id>44</virtual_machine_id>
  <name>test</name>
  <is_built>false</is_built>
  <created_at>2022-06-01T13:42:13.394+03:00</created_at>
  <updated_at>2022-06-01T13:42:13.394+03:00</updated_at>
  <note>null</note>
</virtual_machine_snapshot>

Where:

id - the ID of the snapshot

virtual_machine_id - the ID of the virtual server for which the snapshot is created

name - the label of the snapshot

is_built - true if the snapshot is built; otherwise, false

created_at - the date when the snapshot was created in the [YYYY][MM][DD]T[hh][mm][ss] format

updated_at - the date when the snapshot was updated in the [YYYY][MM][DD]T[hh][mm][ss] format

note - the text added to the snapshot