Actions
Actions represent the state of a request over time; they are very important for tracking what are all the active, completed or failed asynchronous requests and their current status.
Latest Actions.
A simple request is available to get the last 50 actions:
HTTP request
GET /ecs/v2/actions
HTTP Response
{
"status": "ok",
"actions": [
{
"id": 709, //action id
"status": "completed",
"user": "foo",
"created_at": "2024-10-19T15:08:55.887799+00:00",
"started_at": "2024-10-19T15:08:55.887284+00:00",
"completed_at": "2024-10-19T15:09:56.067592+00:00",
"resource": "ec200285",
"resource_type": "ECS",
"type": "delete_server",
"progress": 100
}
{
"id": 708,
"status": "completed",
"user": "foo",
"created_at": "2024-10-18T15:08:55.887799+00:00",
"started_at": "2024-10-18T15:08:55.887284+00:00",
"completed_at": "2024-10-18T15:09:56.067592+00:00",
"resource": "ec200285",
"resource_type": "ECS",
"type": "new_server",
"progress": 100
},
...
],
"total_actions": 754
}
Searching among actions.
To do targeted searches among actions our query exposes several parameters that allow us to paginate the results and search our actions by resource.
Pagination
To paginate the results, 'start' and 'length' parameters are available, which define respectively:
- From which action I want to start my pagination.
- How many actions it needs to last.
Take for example the need to get 20 actions by skipping the last 40 actions.
HTTP request
GET /ecs/v2/actions?start=40&length=20
Info
Remember actions are always sorted by most recent.
Search by resource
In addition to paging another important feature to use on actions is searching by resource, this operation can be performed using the 'resource' parameter.
Let's say we want to search for all actions involving 'ec000001'.
HTTP request
GET /ecs/v2/actions?resource=ec000001
Info
Remember if both paging and resource search are used the former takes precedence over the latter.
If I run the following query:
GET /ecs/v2/actions?resource=ec000001&start=40&length=20
I will get 20 actions concerning ec000001 skipping the first 40, pagination will then be done after extracting the actions concerning ec000001.
A Specific Action.
Of course, it is also possible to monitor a single action; this can be useful for checking whether or not a server has been created.
To do this, the following request is sufficient:
HTTP request
GET /ecs/v2/actions/{actionid}
HTTP Response
{
"status": "ok",
"action": {
"id": 709,
"status": "completed",
"user": "foo",
"created_at": "2024-10-19T15:08:55.887799+00:00",
"started_at": "2024-10-19T15:08:55.887284+00:00",
"completed_at": "2024-10-19T15:09:56.067592+00:00",
"resource": "ec200285",
"resource_type": "ECS",
"type": "delete_server",
"progress": 100
}
}