Consumi
Le nostre API espongono anche i consumi della piattaforma, queste informazioni sono disponibili in due formati:
- CSV
- JSON
Le informazioni sui consumi sono divise per Server e per Template
Consumi Server
Per ricevere i consumi dei server è esposto il seguente endpoint:
HTTP Request
GET /ecs/v2/billing/servers/<year>/<month>
Consumi Server CSV
Per ottenere i consumi in formato CSV è necessario utilizzare il parametro "type" nella query di richiesta:
HTTP Request
GET /ecs/v2/billing/servers/<year>/<month>?type=csv
Si ricevera una risposta di tipo text/csv contenente i consumi richiesti
Consumi Server JSON
Per ottenere i consumi in formato JSON è necessario utilizzare il parametro "type" nella query di richiesta:
HTTP Request
GET /ecs/v2/billing/servers/<year>/<month>?type=json
HTTP Response
[
{
"plan": "ECS1",
"name": "ec200200",
"group": null,
"notes": "centos-ecs1-it-fr2-1713866700891",
"status": "Booted",
"year": 2024,
"month": 4,
"creation_date": "2024-04-23T10:06:22.973332+00:00",
"deletion_date": null,
"billed_hours": 182,
"cost": 2.64,
"summary": {
"online_hour": 1,
"online_price": 0.02,
"offline_hour": 0,
"offline_discount": 20,
"offline_price": 0.0,
"offline_reduction": 0.0,
"reserved_discounts": [
{
"reserved_plan": 26,
"reserved_hour": 181,
"reserved_discount": 15,
"reserved_price": 2.62,
"reserved_reduction": 0.46,
"reserved_start_date": "2024-04-23T10:06:22.973332+00:00",
"reserved_end_date": "2024-10-23T10:06:22.973332+00:00"
}
],
"original_cost": 3.09
}
},
]
Consumi Template
Per ricevere i consumi dei template è esposto il seguente endpoint:
HTTP Request
GET /ecs/v2/billing/templates/<year>/<month>
Consumi Template CSV
Per ottenere i consumi in formato CSV è necessario utilizzare il parametro "type" nella query di richiesta:
HTTP Request
GET /ecs/v2/billing/templates/<year>/<month>?type=csv
Si ricevera una risposta di tipo text/csv contenente i consumi richiesti
Consumi Template JSON
Per ottenere i consumi in formato JSON è necessario utilizzare il parametro "type" nella query di richiesta:
HTTP Request
GET /ecs/v2/billing/templates/<year>/<month>?type=json
HTTP Response
[
{
"cost": 0.18,
"name": "ei200112",
"status": "Created",
"creation_date": "2025-02-05T08:10:49.938995+00:00",
"deletion_date": null,
"notes": "MyDemo",
"year": 2025,
"month": 2,
"hours": 55,
"size_on_disk": 1510080
},
]
Consumi Snapshot
Per ricevere i consumi degli snapshot è esposto il seguente endpoint:
HTTP Request
GET /ecs/v2/billing/snapshots/<year>/<month>
Consumi Snapshot CSV
Per ottenere i consumi in formato CSV è necessario utilizzare il parametro "type" nella query di richiesta:
HTTP Request
GET /ecs/v2/billing/snapshots/<year>/<month>?type=csv
Si ricevera una risposta di tipo text/csv contenente i consumi richiesti
Consumi Snapshot JSON
Per ottenere i consumi in formato JSON è necessario utilizzare il parametro "type" nella query di richiesta:
HTTP Request
GET /ecs/v2/billing/snapshots/<year>/<month>?type=json
HTTP Response
{
"year": 2025,
"month": 2,
"total_cost": 3.7,
"rows_count": 37,
"snapshots": [
{
"snapshot": 58,
"snapshot_name": "ec200404-SNP-6",
"snapshot_status": "DD",
"snapshot_status_label": "Deleted",
"snapshot_description": "periodic snapshot - 2025-01-31T12:00:00.104930+00:00",
"snapshot_created_at": "2025-01-31T12:00:00.129801+00:00",
"snapshot_deleted_at": "2025-02-03T16:36:55.938131+00:00",
"size_on_disk": 1571400,
"hours": 65,
"final_cost": 0.1
},
],
}