Articles on: API

Export charts directly to PNG

You can use the API to directly fetch a graph in PNG format so you won't have to use a library to convert the data to a chart.

The API endpoint is as follows:

https://api.eu.nixstats.com/v1/server/SERVER_ID/metrics?token=API_TOKEN&output=png&metric=cpu&key=i:idle,st:steal&min=0&max=100&width=1200&height=300


This will request the CPU Idle and CPU Steal values.

The key attribute is optional. If you exclude it will return all keys. The key attribute can also contain a "pretty name".

https://api.eu.nixstats.com/v1/server/SERVER_ID/metrics?token=API_TOKEN&output=png&metric=cpu&key=i:idle,st:steal&device=0,1&min=0&max=100&width=1200&height=300


This will request the CPU idle and steal values for core 0 and 1

These requests will return the following JSON data:

{"uri":"https:\/\/api.eu.nixstats.com\/tmp\/JwAKsZH3LrtFAfTIdbFhPb48uEfvTwaC31mvO3yAu2g5h9OultMaFQj9dyE65PI8.png"}


Here's an example of a chart exported by the API.

Updated on: 12/04/2018

Was this article helpful?

Share your feedback

Cancel

Thank you!