Get User's Statistics for Particular Period

To view the hourly cost and amount of the resources used by a user, use the following request:

GET /users/:user_id/user_statistics.xml?hourly_stats
GET /users/:user_id/user_statistics.json?hourly_stats

XML Request Example:

curl -i -X GET -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass http://onapp.test/users/4/user_statistics.xml?hourly_stats


JSON Request Example:

curl -i -X GET -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass http://onapp.test/users/4/user_statistics.json?hourly_stats


XML Output Example:

<user_stats type="array">
<user_stat>
<backup_cost type="decimal">0.0</backup_cost>
<user_resources_cost type="decimal">0.0</user_resources_cost>
<currency_code>USD</currency_code>
<total_cost type="decimal">0.0</total_cost>
<template_cost type="decimal">0.0</template_cost>
<storage_disk_size_cost type="decimal">0.0</storage_disk_size_cost>
<edge_group_cost type="decimal">0.0</edge_group_cost>
<backup_cost type="decimal">0.0</backup_cost>
<template_cost type="decimal">0.0</template_cost>
<user_id type="integer">4</user_id>
<backup_disk_size_cost type="decimal">0.0</backup_disk_size_cost>
<monit_cost type="decimal">0.0</monit_cost>
<stat_time type="datetime">2012-03-13T11:43:36Z</stat_time>
<template_disk_size_cost type="decimal">0.0</template_disk_size_cost>
<vm_cost type="integer">0</vm_cost>
<vm_stats type="array"/>
</user_stat>
<user_stat>
<backup_cost type="decimal">0.0</backup_cost>
<user_resources_cost type="decimal">0.0</user_resources_cost>
<currency_code>USD</currency_code>
<total_cost type="decimal">0.0</total_cost>
<template_cost type="decimal">0.0</template_cost>
<storage_disk_size_cost type="decimal">0.0</storage_disk_size_cost>
<edge_group_cost type="decimal">0.0</edge_group_cost>
<backup_cost type="decimal">0.0</backup_cost>
<template_cost type="decimal">0.0</template_cost>
<user_id type="integer">4</user_id>
<backup_disk_size_cost type="decimal">0.0</backup_disk_size_cost>
<monit_cost type="decimal">0.0</monit_cost>
<stat_time type="datetime">2012-03-13T12:43:37Z</stat_time>
<template_disk_size_cost type="decimal">0.0</template_disk_size_cost>
<vm_cost type="integer">0</vm_cost>
<vm_stats type="array"/>
</user_stat>
...
</user_stats> 


For parameters description, refer to View user's statistics section.


To view the cost and amount of the resources used for a particular period:

GET /users/:user_id/user_statistics.xml?hourly_stats&period[startdate]=YYYY-MM-DD+hh%3Amm%3Ass&period[enddate]=YYYY-MM-DD+hh%3Amm%3Ass 
GET /users/:user_id/user_statistics.json?hourly_stats&period[startdate]=YYYY-MM-DD+hh%3Amm%3Ass&period[enddate]=YYYY-MM-DD+hh%3Amm%3Ass

XML Request Example

curl -i -X GET -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass "http://onapp.test/users/:user_id/user_statistics.xml?hourly_stats&period[startdate]=2012-03-15+06:58:16&period[enddate]=2012-03-15+08:58:16"
 

JSON Request example

curl -i -X GET -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass 
"http://onapp.test/users/:user_id/user_statistics.json?hourly_stats&period[startdate]=2012-03-15+06:58:16&period[enddate]=2012-03-15+08:58:16"
 


XML Output Example:

<?xml version="1.0" encoding="UTF-8"?>
<user_stats type="array">
<user_stat>
<backup_cost type="decimal">0.0</backup_cost>
<user_resources_cost type="decimal">0.0</user_resources_cost>
<currency_code>USD</currency_code>
<total_cost type="decimal">0.0</total_cost>
<template_cost type="decimal">0.0</template_cost>
<storage_disk_size_cost type="decimal">0.0</storage_disk_size_cost>
<edge_group_cost type="decimal">0.0</edge_group_cost>
<backup_cost type="decimal">0.0</backup_cost>
<template_cost type="decimal">0.0</template_cost>
<user_id type="integer">4</user_id>
<backup_disk_size_cost type="decimal">0.0</backup_disk_size_cost>
<monit_cost type="decimal">0.0</monit_cost>
<stat_time type="datetime">2012-03-15T06:58:16Z</stat_time>
<template_disk_size_cost type="decimal">0.0</template_disk_size_cost>
<vm_cost type="integer">0</vm_cost>
<vm_stats type="array"/>
</user_stat>
<user_stat>
<backup_cost type="decimal">0.0</backup_cost>
<user_resources_cost type="decimal">0.0</user_resources_cost>
<currency_code>USD</currency_code>
<total_cost type="decimal">0.0</total_cost>
<template_cost type="decimal">0.0</template_cost>
<storage_disk_size_cost type="decimal">0.0</storage_disk_size_cost>
<edge_group_cost type="decimal">0.0</edge_group_cost>
<backup_cost type="decimal">0.0</backup_cost>
<template_cost type="decimal">0.0</template_cost>
<user_id type="integer">4</user_id>
<backup_disk_size_cost type="decimal">0.0</backup_disk_size_cost>
<monit_cost type="decimal">0.0</monit_cost>
<stat_time type="datetime">2012-03-15T07:58:17Z</stat_time>
<template_disk_size_cost type="decimal">0.0</template_disk_size_cost>
<vm_cost type="integer">0</vm_cost>
<vm_stats type="array"/>
</user_stat>
</user_stats> 


For parameters description, refer to View user's statistics section.


Page History

v.5.6

  • replaced the backup_count_cost parameter with the backup_cost parameter
  • replaced the ova_count_cost parameter with the ova_cost parameter
  • replaced the template_count_cost parameter with the template_cost parameter