GET /virtual-machines
List all the creates VMs.
This route does not require any parameters.
The response body contains a JSON array with the following properties:
hostname
- the hostname of the VMos
- the operating system of the VMip
- the IP address of the VMcpu
- the number of CPU cores of the VMram
- the amount of RAM of the VM (in GB)_id
- the UUID of the VM
200
(OK) - The VMs have been successfully retrieved
curl -B https://api.dai.heig.lutonite.dev//virtual-machines
GET /virtual-machines/{vmId}
Get one VM by its Id.
The request path must contain the Id of the VM.
The response body contains a JSON object with the following properties:
hostname
- the hostname of the VMos
- the operating system of the VMip
- the IP address of the VMcpu
- the number of CPU cores of the VMram
- the amount of RAM of the VM (in GB)_id
- the UUID of the VM
200
(OK) - The VM has been successfully retrieved400
(Bad Request) - The vmId is not a valid UUID404
(Not Found) - a VM with that uuid doesn't exist
curl -B https://api.dai.heig.lutonite.dev//virtual-machines/e722f4cc-4c37-4d93-9c97-ff0d4fa82fbe
POST /virtual-machines
Create one VM.
The request body must contain a JSON object with the following properties:
hostname
- the hostname of the VMos
- the operating system of the VMip
- the IP address of the VMcpu
- the number of CPU cores of the VMram
- the amount of RAM of the VM (in GB)
The response body contains a JSON object with the following properties:
hostname
- the hostname of the VMos
- the operating system of the VMip
- the IP address of the VMcpu
- the number of CPU cores of the VMram
- the amount of RAM of the VM (in GB)_id
- the UUID of the VM
200
(OK) - The VM has been successfully created400
(Bad Request) - The request body is not valid
curl -i -X POST -v "Content-Type: application/json" -d '{"hostname":"example.test","os":"Windows","ip":"1.1.1.1","cpu":"3","ram":"32"}' https://api.dai.heig.lutonite.dev//virtual-machines
PUT /virtual-machines/{vmId}
Update one VM by its Id.
The request path must contain the Id of the VM.
The request body must contain a JSON object with the following properties:
hostname
- the hostname of the VMos
- the operating system of the VMip
- the IP address of the VMcpu
- the number of CPU cores of the VMram
- the amount of RAM of the VM (in GB)
The response body is empty
200
(OK) - The VM has been successfully updated400
(Bad Request) - The vmId is not a valid UUID400
(Bad Request) - The request body is not valid404
(Not Found) - a VM with that uuid doesn't exist
curl -i -X PUT -v "Content-Type: application/json" -d '{"hostname":"example.test","os":"Windows","ip":"1.1.1.1","cpu":"3","ram":"32"}' https://api.dai.heig.lutonite.dev//virtual-machines/e722f4cc-4c37-4d93-9c97-ff0d4fa82fbe
DELETE /virtual-machines/{vmId}
Delete one VM by its Id.
The request path must contain the Id of the VM.
The response body is empty.
204
(No Content) - The virtual machine was deleted400
(Bad Request) - The vmId is not a valid UUID404
(Not Found) - The virtual machine doesn't exist
curl -i -X DELETE -v "Content-Type: application/json"https://api.dai.heig.lutonite.dev//virtual-machines/e722f4cc-4c37-4d93-9c97-ff0d4fa82fbe