Schedules
List all schedules
Request
Definition
GET /api/v1/reports/schedules
Headers
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
Query string parameter
Parameter | Type | Required | Description |
---|---|---|---|
paginate | boolean | Yes | If the result must be paginated. |
page | integer | Yes if paginate is true | Page index. |
page_size | integer | Yes if paginate is true | Number of items displayed per page. |
id | integer | No | Filters the results related to the schedule ID entered. |
id_list | array<string> | No | Filters the results related to the schedule IDs contained in the specified list. |
name | string | No | Filters the results whose schedule name matches all or part of the specified string. |
type | string | No | Filters the results whose schedule type matches the one entered. |
schedule | string | No | Filters the results related to the specified report run frequency. |
scheduled_at_start | integer | No | Filters reports scheduled after the date entered. |
scheduled_by_end | integer | No | Filters reports scheduled before the date entered. |
scheduled_by | string | No | Filters the results where the user specified in scheduled_by matches the one entered. |
Response
Status codes
Status code | Message |
---|---|
200 | "List of report schedules" |
400 | "Error with pagination fields" |
403 | "Forbidden" |
Body
- Attributi
- Esempio
-
data.registries.name
stringSchedule name.
-
data.registries.id
stringSchedule ID.
-
data.registries.hosts
array<string>Hosts reported and observed in the report.
-
data.registries.end_timestamp
integerDate the report was last executed, in UNIX format (microseconds).
-
data.registries.start_timestamp
integerDate of the first execution of the report in UNIX format (microseconds).
-
data.registries.scheduled_by
stringName of the user who created the schedule.
-
data.registries.scheduled_at
integerDate the schedule was created in UNIX format (microseconds).
-
data.registries.schedule
integerFrequency of planned creation.
-
data.registries.type
stringThe type of planning.
-
data.registries.send_to
stringEmail address to which the report will be sent.
-
data.registries.send_via
stringMethod used to send the report.
-
data.registries.services
array<string>Domain Groups involved in the report.
-
data.registries.timezone
stringTimezone associated with the time interval for which the report was created.
{
"data": {
"schedules": [
{
"end_timestamp": null,
"hosts": [
"www.service-test-host.it"
],
"id": "9fxx26xe-xxxx-49a5-xxxx-exxb9xxx9fx6",
"name": "one_shot_generic",
"schedule": "daily",
"scheduled_at": 1705497135708315,
"scheduled_by": "username",
"send_to": [
"test@test.it"
],
"send_via": "email",
"services": null,
"start_timestamp": null,
"timezone": "Europe/Rome",
"type": "generic"
}
]
},
"message": "List of report schedules",
"pagination": {
"first": 1,
"last": 1,
"page": 0,
"total_count": 1,
"total_pages": 1
},
"status": "ok"
}
List a specific schedule
Request
Definition
GET /api/v1/reports/schedules/{schedule_id}
Headers
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
Response
Status codes
Status code | Message |
---|---|
200 | "Report schedule retrieved" |
400 | "Error retrieving schedules" |
400 | "Error with pagination fields" |
403 | "Forbidden" |
Body
{
"data": {
"schedule": {
"end_timestamp": null,
"hosts": [
"www.service-test-host.it"
],
"id": "407xxxab-xxxx-4b04-xxxx-7xxxcdxxa2x8",
"name": "one_shot_generic",
"schedule": "daily",
"scheduled_at": 1705497139412776,
"scheduled_by": "username",
"send_to": [
"test@test.it"
],
"send_via": "email",
"services": null,
"start_timestamp": null,
"timezone": "Europe/Rome",
"type": "generic"
}
},
"message": "Report schedule retrieved",
"status": "ok"
}
Create a schedule
Request
Definition
POST /api/v1/reports/schedules
Headers
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
-
Content-Type
requiredapplication/json
Request body
{
"attrs": {
"hosts": [
"www.service-test-host.it"
],
"name": "one_shot_generic",
"schedule": "daily",
"send_to": [
"test@test.it"
],
"send_via": "email",
"timezone": "Europe/Rome",
"type": "generic"
}
}
Response
Status codes
Status code | Message |
---|---|
200 | "Report schedule created succesfully" |
400 | "Error creating new schedule" |
403 | "Forbidden" |
Body
{
"data": {
"schedule": {
"end_timestamp": null,
"hosts": [
"www.service-test-host.it"
],
"id": "09x04xx2-xxxx-48b5-xxxx-2x0xxx263xxf",
"name": "one_shot_generic",
"schedule": "daily",
"scheduled_at": 1705497138483506,
"scheduled_by": "username",
"send_to": [
"test@test.it"
],
"send_via": "email",
"services": null,
"start_timestamp": null,
"timezone": "Europe/Rome",
"type": "generic"
}
},
"message": "Report schedule created succesfully",
"status": "ok"
}
Update a schedule
Request
Definition
PUT /api/v1/reports/schedules/{schedule_id}
Headers
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
-
Content-Type
requiredapplication/json
Request body
{
"attrs": {
"send_to": [
"test@test.it",
"test2@test.it"
],
"send_via": "email"
}
}
Response
Status codes
Status code | Message |
---|---|
200 | "Report schedule updated succesfully" |
400 | "Error updating schedule" |
403 | "Forbidden" |
Body
{
"data": {
"schedule": {
"end_timestamp": null,
"hosts": [
"www.service-test-host.it"
],
"id": "09x04xx2-xxxx-48b5-xxxx-2x0xxx263xxf",
"name": "one_shot_generic",
"schedule": "daily",
"scheduled_at": 1705497136642579,
"scheduled_by": "username",
"send_to": [
"test@test.it",
"test2@test.it"
],
"send_via": "email",
"services": null,
"start_timestamp": null,
"timezone": "Europe/Rome",
"type": "generic"
}
},
"message": "Report schedule updated succesfully",
"status": "ok"
}
Delete multiple schedules
Request
Definition
DELETE /api/v1/reports/registries
Headers
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
Request body
{
"schedules_ids": [
"09x04xx2-xxxx-48b5-xxxx-2x0xxx263xxf"
]
}
Response
Status codes
Status code | Message |
---|---|
200 | "Schedules succesfully deleted" |
400 | "Error deleting report schedules" |
403 | "Forbidden" |
Body
{
"message": "Schedules succesfully deleted",
"status": "ok"
}