Get a list of daily usage metrics
package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://api.wpengineapi.com/v1/installs/294deacc-d8b8-4005-82c4-0727ba8ddde0/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <credentials>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.wpengineapi.com/v1/installs/294deacc-d8b8-4005-82c4-0727ba8ddde0/usage';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.wpengineapi.com/v1/installs/294deacc-d8b8-4005-82c4-0727ba8ddde0/usage \ --header 'Authorization: Basic <credentials>'Get a list of daily usage metrics related to this install.
If the optional first_date and last_date arguments are omitted, the response will include metrics for the last 30 days.
For days where there are no storage metrics, they will be artificially filled with the last known storage metrics.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The UUID of the install.
Example
294deacc-d8b8-4005-82c4-0727ba8ddde0Query Parameters
Section titled “Query Parameters”The start date for the requested metrics range (inclusive).
Format: YYYY-mm-dd. Cannot be older than 13 months.
If first_date is provided, last_date must also be provided.
The end date for the requested metrics range (inclusive).
Format: YYYY-mm-dd.
If last_date is provided, first_date must also be provided.
Responses
Section titled “Responses”A successful response.
A daily usage metrics series.
object
The name of the install for the included metrics.
The requested metrics for an install. Metrics will include daily usage metrics for the last 30 days. Metrics will be sorted in descending order (most recent date first).
Usage metrics collected over the period of one day.
In JSON format, the DailyUsageMetrics int64 values are encoded as a string rather than a number, following the proto3 specification.
object
The date (ISO 8601).
Total visits.
Data served over HTTP by the origin server.
This does not include cached data served from a CDN.
Storage used by this environment’s files.
This includes all files in the web root directory.
Storage used by this environment’s database.
Billable visits.
The total number of HTTP requests received by the origin server.
This does not include cached requests that were served from a CDN.
The data served by the CDN.
The most recent storage usage measurement time (in UTC).
The sum of CDN and origin network bytes.
The source of the traffic metrics.
- TRAFFIC_METRICS_SOURCE_UNSPECIFIED: The source of the traffic metrics is unknown.
- ONHOST: The traffic metrics is sourced from onhost logcrunch (legacy).
- BIGQUERY: The traffic metrics is sourced from BigQuery logcrunch.
The number of tables in the install’s database.
The sum of bytes of the database content in MySQL for an install.
The sum of bytes that is automatically loaded on each request to the install.
A rollup of usage metrics.
object
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
A metric rollup.
object
The average value of the metric.
The total sum value of the metric.
The latest information.
object
The date (ISO 8601).
The value.
Represents the estimated completion time (in UTC) for a refresh disk usage operation. If a refresh is not in progress, then this field will be null.
Example
{ "metrics": [ { "traffic_metrics_source": "TRAFFIC_METRICS_SOURCE_UNSPECIFIED" } ]}Bad Request. The request was improperly formatted or contained invalid parameters.
object
A message explaining the error.
Example
{ "message": "Must provide or omit both first_date and last_date."}Not Found. The requested install id does not exist.
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Examples
{ "message": "Not found"}default
Section titled “default”An unexpected error response.
object
A message regarding the error that occurred on the server
Example
{ "message": "An unexpected error occurred, please try again in a few minutes"}