diff --git a/source/index.html.md b/source/index.html.md index 973c9df336f..6174a9b33c0 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -987,14 +987,14 @@ curl "https://my.timelline.is/api/v3p/devices/5d1f0bf741092775efbddd71/close_tun ``` -# Agents +# Tetherboxes -## Get Connection History +## Get Status -This endpoint retrieves connection history (limit 50 records) of agent. +This endpoint status tethebox status info. ### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/connection_history` +`GET https://my.timeline.is/api/v3p/tetherboxes/:serial/status` **Parameters** @@ -1002,76 +1002,140 @@ This endpoint retrieves connection history (limit 50 records) of agent. | ---- | ---------- | ----------- | -------- | ---- | ```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/connection_history" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" +curl "https://my.timeline.is/api/v3p/agents/:serial/status" -H "Authorization: Bearer YOUR_OAUTH_TOKEN" ``` > The above command returns JSON structured like this: ```json { - "connection_history": [ - { - "date": "2021-06-23 14:35:38 +0100", - "type": "Connected", - "untrusted_ip": "139.162.218.118", - "bytes_received": "N/A", - "bytes_sent": "N/A", - "time_duration": "N/A" - }, - { - "date": "2021-06-23 14:35:36 +0100", - "type": "Disconnected", - "untrusted_ip": "139.162.218.118", - "bytes_received": "94.9 MB", - "bytes_sent": "82.2 MB", - "time_duration": "about 1 month" - }, - { - "date": "2021-05-12 17:16:43 +0100", - "type": "Connected", - "untrusted_ip": "139.162.218.118", - "bytes_received": "N/A", - "bytes_sent": "N/A", - "time_duration": "N/A" + "data": { + "id": "5d5d05ca7fe76e098d8eb7a9", + "type": "agents", + "attributes": { + "speedtest": { + "download": "94.32 Mbit/s", + "upload": "94.92 Mbit/s", + "last_run": "2021-07-25T04:31:36.514+01:00" + }, + "external_ip": "78.137.9.196", + "interfaces_api": { + "enp2s0": { + "mtu": "1500", + "speed": "100", + "address": "e0:d5:5e:ee:dd:a6", + "rx_bytes": 32995563694, + "tx_bytes": 1932618710, + "ips": [ + "10.11.160.11/24" + ] + }, + "wlp1s0": { + "wireless": true, + "mtu": "1500", + "address": "04:d3:b0:87:0c:e4", + "rx_bytes": "0", + "tx_bytes": "0", + "ips": [] + } + }, + "online": true, + "timeline_id": "5c505e797fe76e7b48b06151", + "location_id": "5c5d7a727fe76e0967b6bc5b", + "uptime": "10 days", + "recent_reboots": [ + "reboot system boot 4.15.0-137-gener 2021-07-16T16:43:08+0100 still running", + "reboot system boot 4.15.0-137-gener 2021-07-15T09:26:20+0100 - 2021-07-15T09:30:50+0100 (00:04)", + "reboot system boot 4.15.0-137-gener 2021-07-07T09:47:07+0100 - 2021-07-15T09:30:50+0100 (7+23:43)", + "reboot system boot 4.15.0-137-gener 2021-07-05T08:21:43+0100 - 2021-07-06T16:27:34+0100 (1+08:05)", + "reboot system boot 4.15.0-137-gener 2021-06-25T08:03:00+0100 - 2021-07-06T16:27:34+0100 (11+08:24)", + "reboot system boot 4.15.0-137-gener 2021-06-04T14:34:08+0100 - 2021-07-06T16:27:34+0100 (32+01:53)", + "reboot system boot 4.15.0-137-gener 2021-05-04T12:50:22+0100 - 2021-07-06T16:27:34+0100 (63+03:37)", + "reboot system boot 4.15.0-137-gener 2021-05-04T09:19:37+0100 - 2021-05-04T12:49:41+0100 (03:30)", + "reboot system boot 4.15.0-137-gener 2021-04-05T11:23:14+0100 - 2021-05-04T12:49:41+0100 (29+01:26)", + "reboot system boot 4.15.0-137-gener 2021-04-05T11:01:23+0100 - 2021-04-05T11:22:47+0100 (00:21)", + "reboot system boot 4.15.0-137-gener 2021-04-04T21:18:31+0100 - 2021-04-05T11:00:59+0100 (13:42)" + ], + "connection_history": [{ + "date": "2021-07-26 12:25:59 +0100", + "type": "Connected", + "untrusted_ip": "78.137.9.196" + }, + { + "date": "2021-07-26 12:25:57 +0100", + "type": "Disconnected", + "untrusted_ip": "78.137.9.196", + "bytes_received": "53.4 KB", + "bytes_sent": "35.1 KB", + "time_duration": "24 minutes" + }, + { + "date": "2021-07-26 12:01:34 +0100", + "type": "Connected", + "untrusted_ip": "78.137.9.196" + }, + { + "date": "2021-07-26 12:01:32 +0100", + "type": "Disconnected", + "untrusted_ip": "78.137.9.196", + "bytes_received": "19.5 KB", + "bytes_sent": "12 KB", + "time_duration": "8 minutes" + }, + { + "date": "2021-07-26 11:53:51 +0100", + "type": "Connected", + "untrusted_ip": "78.137.9.196" + }, + { + "date": "2021-07-26 11:53:49 +0100", + "type": "Disconnected", + "untrusted_ip": "78.137.9.196", + "bytes_received": "10 KB", + "bytes_sent": "6.06 KB", + "time_duration": "3 minutes" + }, + { + "date": "2021-07-26 11:50:45 +0100", + "type": "Disconnected", + "untrusted_ip": "78.137.9.196", + "bytes_received": "93.9 KB", + "bytes_sent": "58.4 KB", + "time_duration": "39 minutes" + }, + { + "date": "2021-07-26 11:50:39 +0100", + "type": "Connected", + "untrusted_ip": "78.137.9.196" + }, + { + "date": "2021-07-26 11:12:06 +0100", + "type": "Disconnected", + "untrusted_ip": "78.137.9.196", + "bytes_received": "8 KB", + "bytes_sent": "4.79 KB", + "time_duration": "3 minutes" + }, + { + "date": "2021-07-26 11:12:04 +0100", + "type": "Connected", + "untrusted_ip": "78.137.9.196" + } + ] } - ] -} -``` - -## Get Connection Speed - -This endpoint retrieves connection speed of agent. - -### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/connection_speed` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | - -```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/connection_speed" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" -``` - -> The above command returns JSON structured like this: - -```json -{ - "connection_speed": { - "download": "425.37 Mbit/s", - "upload": "441.53 Mbit/s", - "last_run": "2021-06-06T03:39:32.563+01:00" + }, + "jsonapi": { + "version": "1.0" } } ``` -## GET External IP +## Get devices -This endpoint retrieves external IP of agent. +This endpoint retrieves devices related to tetherbox. ### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/external_ip` +`GET https://my.timeline.is/api/v3p/tetherboxes/:serial/devices` **Parameters** @@ -1079,177 +1143,39 @@ This endpoint retrieves external IP of agent. | ---- | ---------- | ----------- | -------- | ---- | ```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/external_ip" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" -``` - -> The above command returns JSON structured like this: - -```json -{ "external_ip": "88.109.208.22" } -``` - -## Get Network Interface Details - -This endpoint retrieves network interface details of agent. - -### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/network_interface_details` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | - -```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/network_interface_details" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" +curl "https://my.timeline.is/api/v3p/tetherboxes/:serial/devices" -H "Authorization: Bearer YOUR_OAUTH_TOKEN" ``` > The above command returns JSON structured like this: ```json { - "network_interface_details": { - "eth0": { - "mtu": "1500", - "speed": "100", - "address": "b8:ae:ed:7b:27:0f", - "rx_bytes": "5743225639", - "tx_bytes": "41546301", - "ips": ["192.168.1.11/24", "192.168.88.100/24"] - }, - "wlp2s0": { - "wireless": true, - "mtu": "1500", - "address": "94:65:9c:d2:2e:e0", - "rx_bytes": 0, - "tx_bytes": 0, - "ips": [] + "devices": [{ + "device_id": "5d5d40857fe76e09a78eb7be", + "name": "device in Ukraine", + "last_seen": "2021-07-16T16:48:06.270+01:00", + "ip": "192.168.2.1", + "mac": "CC:2D:E0:75:90:AF", + "online": true }, - "tun0": { - "mtu": "1500", - "speed": "10", - "address": "be:2a:2b:f0:fa:27", - "rx_bytes": "41977529", - "tx_bytes": "18039799", - "ips": ["10.7.0.97/16"] + { + "device_id": "5d5d40887fe76e098d8eb7c2", + "name": "device in Ukraine", + "last_seen": "2021-07-16T16:48:02.265+01:00", + "ip": "10.11.160.4", + "mac": "E0:D5:5E:CC:1B:9D", + "online": true } - } -} -``` - -## Get Uptime - -This endpoint retrieves uptime of agent. - -### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/uptime` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | - -```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/uptime" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" -``` - -> The above command returns JSON structured like this: - -```json -{ "uptime": "2 hours" } -``` - -## Get Status - -This endpoint retrieves online/offline status of agent. - -### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/status` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | - -```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/status" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" -``` - -> The above command returns JSON structured like this: - -```json -{ "status": "online" } -``` - -## recent_reboots - -This endpoint retrieves recent reboots of agent. - -### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/recent_reboots` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | - -```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/recent_reboots" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" -``` - -> The above command returns JSON structured like this: - -```json -{ - "recent_reboots": [ - "reboot system boot 4.15.0-137-gener 2021-04-01T15:12:49+0100 still running", - "reboot system boot 4.15.0-137-gener 2021-03-29T19:42:43+0100 - 2021-04-01T15:12:38+0100 (2+19:29)", - "reboot system boot 4.15.0-137-gener 2021-03-29T16:39:23+0100 - 2021-03-29T19:42:31+0100 (03:03)", - "reboot system boot 4.15.0-137-gener 2021-03-29T13:37:33+0100 - 2021-03-29T16:39:12+0100 (03:01)", - "reboot system boot 4.15.0-136-gener 2021-03-11T15:25:48+0000 - 2021-03-29T13:37:21+0100 (17+21:11)", - "reboot system boot 4.15.0-135-gener 2021-03-02T16:15:20+0000 - 2021-03-11T15:25:37+0000 (8+23:10)", - "reboot system boot 4.15.0-135-gener 2021-03-02T13:12:07+0000 - 2021-03-02T16:15:09+0000 (03:03)", - "reboot system boot 4.15.0-135-gener 2021-03-02T10:08:56+0000 - 2021-03-02T13:11:56+0000 (03:03)", - "reboot system boot 4.15.0-135-gener 2021-03-02T07:05:39+0000 - 2021-03-02T10:08:45+0000 (03:03)", - "reboot system boot 4.15.0-135-gener 2021-03-02T04:02:28+0000 - 2021-03-02T07:05:28+0000 (03:03)", - "reboot system boot 4.15.0-135-gener 2021-03-02T00:59:13+0000 - 2021-03-02T04:02:17+0000 (03:03)" - ] -} -``` - -## devices - -This endpoint retrieves devices of agent. - -### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/devices` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | - -```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/devices" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" -``` - -> The above command returns JSON structured like this: - -```json -{ - "devices": [ - { "device_id": "60c0e29308ad4195d775d9a8", "name": "Device 1" }, - { "device_id": "6058fe9b08ad41341aa59ab1", "name": "Device 2" } ] } ``` -## cameras +## Get cameras -This endpoint retrieves cameras of agent. +This endpoint retrieves cameras related to tetherbox. ### HTTP Request -`GET https://my.timeline.is/api/v3p/agents/:agent_id/cameras` +`GET https://my.timeline.is/api/v3p/tetherboxes/:serial/cameras` **Parameters** @@ -1257,17 +1183,21 @@ This endpoint retrieves cameras of agent. | ---- | ---------- | ----------- | -------- | ---- | ```shell -curl "https://my.timeline.is/api/v3p/agents/\"$AGENT_ID\"/cameras" -H "Authorization: Bearer \"$YOUR_OAUTH_TOKEN\"" +curl "https://my.timeline.is/api/v3p/tetherbox/:serial/cameras" -H "Authorization: Bearer YOUR_OAUTH_TOKEN" ``` > The above command returns JSON structured like this: ```json { - "cameras": [ - { "camera_id": "60c0e29308ad4195d775d9a9", "name": "Camera 1" }, - { "camera_id": "6058fea008ad41341aa59b20", "name": "Camera 2" }, - ] + "cameras": [{ + "camera_id": "5e8fa9077fe76e7b824124f6", + "name": "Camera 3", + "vendor": "Hangzhou Hikvision Digital", + "ip": "10.11.160.252", + "zone": "5e8fa9077fe76e7b824124f5", + "online": true + }] } ```