Trends

Each of these APIs returns a statistical trend as a time series. They are almost idenitical except for query strings. For simplicity of documentation, only unique parameters are listed here.

Flows

The number of blocked flows captured each day.

GET https://msp_domain/v2/trends/flows

Alarms

The number of alarms generated each day.

GET https://msp_domain/v2/trends/alarms

Rules

The number of rules created each day.

GET https://msp_domain/v2/trends/rules

Shared Definitions

Header

Name Value
Authorization required Personal access token

Query String

Name Value
group Gets trends for a specific box group, must be supplied with the ID of a box group. The API returns global statistics by default

Response

200 Success

A JSON array of Trend

[
    { "ts": 1666915200, "value": 53 },
    { "ts": 1666828800, "value": 24 },
    { "ts": 1666742400, "value": 2 },
    { "ts": 1666656000, "value": 22 },
    { "ts": 1666569600, "value": 39 }
]

401 Permission Denied

Examples

const axios = require('axios');

// Change these three configurations to what you need
const msp_domain = process.env.msp_domain || "mydomain.firewalla.net";
const token = process.env.token || "your_personal_access_token";
const type = process.env.type || "alarms";
const group = process.env.group || "137";


axios({
    method: 'get',
    url: `https://${msp_domain}/v2/trends/${type}?group=${group}`,
    headers: {
        Authorization: `Token ${token}`,
        "Content-Type": "application/json"
    }
}).then((res) => {
    let data = res.data;
    console.log(data);
})
curl --request GET  \
--url "https://${msp_domain}/v2/trends/${type}?group=${group}" \
--header "Authorization: Token ${your_personal_access_token}"