geovani-brito / Internet-Speed-Monitor

Um pequeno servidor para monitorar a velocidade da internet usando o serviço do Speedtest.
MIT License
0 stars 1 forks source link

API #3

Open geovani-brito opened 3 years ago

geovani-brito commented 3 years ago

Uma API será criada para controlar todas as funcionalidades do sistema.

geovani-brito commented 3 years ago

Endpoint /api/v1/speedtest

Método: GET Response:

{
    "type": "result",
    "timestamp": "2021-09-03T20:40:24Z",
    "ping": {
        "jitter": 0.42999999999999999,
        "latency": 7.2759999999999998
    },
    "download": {
        "bandwidth": 31503285,
        "bytes": 262131466,
        "elapsed": 8503
    },
    "upload": {
        "bandwidth": 22539451,
        "bytes": 324038406,
        "elapsed": 15000
    },
    "packetLoss": 0,
    "isp": "Vivo",
    "interface": {
        "internalIp": "192.168.30.10",
        "name": "wlp2s0",
        "macAddr": "A4:A2:63:CA:07:53",
        "isVpn": false,
        "externalIp": "201.10.54.138"
    },
    "server": {
        "id": 39253,
        "name": "IMUNIDADE DIGITAL",
        "location": "São Paulo",
        "country": "Brazil",
        "host": "imudspeedtest.velocidadenet.com.br",
        "port": 8080,
        "ip": "201.7.167.90"
    },
    "result": {
        "id": "60018820-0401-68d1-9091-b90bc1416b00",
        "url": "https://www.speedtest.net/result/c/60018820-0401-68d1-9091-b90bc1416b00"
    }
}
geovani-brito commented 3 years ago

Endpoint api/v1/history

Método: POST Request:

{
    "type": "result",
    "timestamp": "2021-09-03T20:40:24Z",
    "ping": {
        "jitter": 0.42999999999999999,
        "latency": 7.2759999999999998
    },
    "download": {
        "bandwidth": 31503285,
        "bytes": 262131466,
        "elapsed": 8503
    },
    "upload": {
        "bandwidth": 22539451,
        "bytes": 324038406,
        "elapsed": 15000
    },
    "packetLoss": 0,
    "isp": "Vivo",
    "interface": {
        "internalIp": "192.168.30.10",
        "name": "wlp2s0",
        "macAddr": "A4:A2:63:CA:07:53",
        "isVpn": false,
        "externalIp": "201.10.54.138"
    },
    "server": {
        "id": 39253,
        "name": "IMUNIDADE DIGITAL",
        "location": "São Paulo",
        "country": "Brazil",
        "host": "imudspeedtest.velocidadenet.com.br",
        "port": 8080,
        "ip": "201.7.167.90"
    },
    "result": {
        "id": "60018820-0401-68d1-9091-b90bc1416b00",
        "url": "https://www.speedtest.net/result/c/60018820-0401-68d1-9091-b90bc1416b00"
    }
}
geovani-brito commented 3 years ago

Endpoint api/v1/history

Método: GET Response:

[
{
    "type": "result",
    "timestamp": "2021-09-03T20:40:24Z",
    "ping": {
        "jitter": 0.42999999999999999,
        "latency": 7.2759999999999998
    },
    "... continua"
}
"... continua"
]

A resposta será um array com objetos do histórico.

Endpoint api/v1/history/:id

Método: GET Response:

{
    "type": "result",
    "timestamp": "2021-09-03T20:40:24Z",
    "ping": {
        "jitter": 0.42999999999999999,
        "latency": 7.2759999999999998
    },
    "... continua"