This repository was archived by the owner on Jul 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
API v1 documentation
Roman Mirr edited this page Oct 17, 2020
·
1 revision
Some operations like creation of container take a while, therefore enqueued. As a result client should receive ID of job.
Substitute version of API instead {{API_VER}}
.
Currently there is no API authentication.
{
"code": 123,
"message": "some error"
}
Enqueue creation of container.
curl -X POST 'http://localhost:5000/{{API_VER}}/containers/' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "ct100",
"ostemplate": "template1"
}'
HTTP status 202 (Accepted).
Example:
{
"message": "success",
"job_id": "fa205b0e-3f3f-4e93-9bb0-d1e9c6467e4e"
}
curl -X GET 'http://localhost:5000/v0.1/containers/:id'
:id
is UUID of container. For example, 54e21881-8620-4bb0-95f1-05f143973a6e
{
"message": "success",
"container": {
"id": "54e21881-8620-4bb0-95f1-05f143973a6e",
"name": "ct100",
"ostemplate": "template1",
"parameters": null,
"created_at": "2020-10-16T15:16:16Z"
}
}
:id
is UUID of job. For example, 95944ace-9a36-47f0-8d7e-8ed8ac4125a0
curl -X PATCH 'http://localhost:5000/{{API_VER}}/containers/:id' \
--header 'Content-Type: application/json' \
--data-raw '{
"parameters":
{
"hostname": "hostname1",
"cpus": "2",
"memsize": "1",
"memsize_units": "G",
"ipadd": "10.0.0.1",
"size": "10",
"size_units": "G",
"nameserver": "1.1.1.1,8.8.8.8"
}
}'
{
"message": "success",
"code": 0
}
curl -X GET 'http://localhost:5000/{{API_VER}}/jobs/:id'
:id
is UUID of job. For example, 95944ace-9a36-47f0-8d7e-8ed8ac4125a0
Example:
{
"message": "success",
"status": "done",
"entity_type": "container",
"entity_id": "54e21881-8620-4bb0-95f1-05f143973a6e"
}
entity_type
represents type of entity.
entity_id
is an ID of entity.