FLARM HUB version 1.8.0
http://10.10.10.10/api
General Principles
- For most API calls such as GET, PUT and POST where json is sent to HUB the "application/json" content-type header is expected.
- For large uploads, progress information is provided by a dedicated progress reporting REST endpoint /transfer/progress
Examples
The use of the command line utility "curl" is a good starting point to facilitate the use of the HUB REST API, and gain some experience with it. Here some examples on how to operate curl in combination with this REST API.
Getting Information
curl -X GET http://10.10.10.10/api/config
{"WIFI_AP_SSID":"FLAFUS10W-000003","WIFI_AP_KEY":"Ravefoli23","BLUETOOTH_NAME":"FLAFUS10W-000003"}
Putting Information
curl -X PUT -H "Content-Type: application/json" -d '"Arthur Dent"' http://10.10.10.10/api/flarm/config/PILOT
"Arthur Dent"
Uploading Firmware and Obstacles Files
curl -X PUT --data-binary "@flarm_firmware.fw" http://10.10.10.10/api/flarm/fw
{"message": "File successfully received"}
The upload progress can be concurrently to the upload queried at:
curl -X GET http://10.10.10.10/api/transfer/progress
{"total":690,"loaded":516}
/info
/reset
/reset post delete
/config
/config get
get /config
Configuration is simply a key/value store. Configuration keys are represented here in upper case, but the API is case insensitive. The configuration values are “typed”, i.e. taking one of the following types: int (32-bit width, signed), double (64-bit), string. Note that JSON does not support integers directly – int types will thus be truncated when storing.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"WIFI_AP_SSID": "FLARM-MATE-c04d6c",
"WIFI_AP_KEY": "SpamAndEggs"
}
/config/{item} get put
get /config/{item}
put /config/{item}
Set the value for the given item.
URI Parameters
- item: required(string)
Body
Media type: application/json
Type: any
Example:
FooBar
/default
/default get
/default/{item} get
get /default/{item}
/logs
/logs get
/logs/{filename} get
get /logs/{filename}
Download the given file's content.
URI Parameters
- filename: required(string)
/system
/system get
get /system
Provides a RTOS system overview containing all tasks, ram usage and wifi.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"heap": {
"current_remaining_heap": 34048,
"largest_free_block": 33208,
"heap_watermark": 32552
},
"wifi": {
"ap": {
"mac": "80:37:73:fd:4b:62",
"ssid": "FLARM_2G",
"channel": 1,
"rssi": -45
},
"sta": [
{
"mac": "b4:9d:0b:79:25:80",
"rssi": -28
}
]
},
"tasks": [
{
"name": "BTC_TASK",
"status": "Blocked",
"runtime": 30256,
"percentage": 0,
"priority": 19,
"stack allocated": 3072,
"stack in use": 496,
"stack remaining": 2576,
"stack watermark": 1392
},
{
"name": "DNS Server",
"status": "Blocked",
"runtime": 1319,
"percentage": 0,
"priority": 0,
"stack allocated": 3072,
"stack in use": 1308,
"stack remaining": 1764,
"stack watermark": 1488
},
{
"name": "DP Server",
"status": "Blocked",
"runtime": 26075,
"percentage": 0,
"priority": 0,
"stack allocated": 3072,
"stack in use": 560,
"stack remaining": 2512,
"stack watermark": 1724
},
{
"name": "DP Socket",
"status": "Blocked",
"runtime": 743,
"percentage": 0,
"priority": 0,
"stack allocated": 3072,
"stack in use": 732,
"stack remaining": 2340,
"stack watermark": 1940
},
{
"name": "DP Virtual",
"status": "Blocked",
"runtime": 13653,
"percentage": 0,
"priority": 0,
"stack allocated": 4096,
"stack in use": 804,
"stack remaining": 3292,
"stack watermark": 2172
},
{
"name": "GLD90 Provider",
"status": "Blocked",
"runtime": 20654,
"percentage": 0,
"priority": 0,
"stack allocated": 3072,
"stack in use": 468,
"stack remaining": 2604,
"stack watermark": 1180
},
{
"name": "HTTPD Server",
"status": "Running",
"runtime": 56533,
"percentage": 0,
"priority": 5,
"stack allocated": 5120,
"stack in use": 1256,
"stack remaining": 3864,
"stack watermark": 2328
},
{
"name": "IDLE0",
"status": "Running",
"runtime": 32368349,
"percentage": 86,
"priority": 0,
"stack allocated": 768,
"stack in use": 424,
"stack remaining": 344,
"stack watermark": 200
},
{
"name": "IDLE1",
"status": "Running",
"runtime": 34364298,
"percentage": 91,
"priority": 0,
"stack allocated": 768,
"stack in use": 424,
"stack remaining": 344,
"stack watermark": 248
},
{
"name": "SBT Bridge",
"status": "Blocked",
"runtime": 10583,
"percentage": 0,
"priority": 0,
"stack allocated": 4096,
"stack in use": 584,
"stack remaining": 3512,
"stack watermark": 3304
},
{
"name": "Tmr Svc",
"status": "Blocked",
"runtime": 32,
"percentage": 0,
"priority": 1,
"stack allocated": 1536,
"stack in use": 452,
"stack remaining": 1084,
"stack watermark": 1084
},
{
"name": "UDP Beacon",
"status": "Blocked",
"runtime": 1413,
"percentage": 0,
"priority": 0,
"stack allocated": 3072,
"stack in use": 1080,
"stack remaining": 1992,
"stack watermark": 1656
},
{
"name": "btController",
"status": "Blocked",
"runtime": 476205,
"percentage": 1,
"priority": 23,
"stack allocated": 3584,
"stack in use": 500,
"stack remaining": 3084,
"stack watermark": 1580
},
{
"name": "btuT",
"status": "Blocked",
"runtime": 11384,
"percentage": 0,
"priority": 20,
"stack allocated": 4096,
"stack in use": 488,
"stack remaining": 3608,
"stack watermark": 2648
},
{
"name": "esp_timer",
"status": "Blocked",
"runtime": 94274,
"percentage": 0,
"priority": 22,
"stack allocated": 2048,
"stack in use": 452,
"stack remaining": 1596,
"stack watermark": 1324
},
{
"name": "hciT",
"status": "Blocked",
"runtime": 11534,
"percentage": 0,
"priority": 22,
"stack allocated": 2048,
"stack in use": 492,
"stack remaining": 1556,
"stack watermark": 1172
},
{
"name": "ipc0",
"status": "Blocked",
"runtime": 4466,
"percentage": 0,
"priority": 24,
"stack allocated": 1024,
"stack in use": 464,
"stack remaining": 560,
"stack watermark": 560
},
{
"name": "ipc1",
"status": "Blocked",
"runtime": 3036843,
"percentage": 8,
"priority": 24,
"stack allocated": 1024,
"stack in use": 420,
"stack remaining": 604,
"stack watermark": 492
},
{
"name": "main",
"status": "Blocked",
"runtime": 3779599,
"percentage": 10,
"priority": 1,
"stack allocated": 4096,
"stack in use": 536,
"stack remaining": 3560,
"stack watermark": 1912
},
{
"name": "sys_evt",
"status": "Blocked",
"runtime": 24224,
"percentage": 0,
"priority": 20,
"stack allocated": 2048,
"stack in use": 516,
"stack remaining": 1532,
"stack watermark": 780
},
{
"name": "tiT",
"status": "Blocked",
"runtime": 62596,
"percentage": 0,
"priority": 18,
"stack allocated": 3072,
"stack in use": 552,
"stack remaining": 2520,
"stack watermark": 1748
},
{
"name": "wifi",
"status": "Blocked",
"runtime": 586430,
"percentage": 1,
"priority": 23,
"stack allocated": 3072,
"stack in use": 504,
"stack remaining": 2568,
"stack watermark": 1128
}
]
}
/transfer
/firmware
/firmware/info get
/firmware/image put
put /firmware/image
Allows to update the Hub firmware over the air. The content length MUST match the binary data to be sent! In order to apply the new firmware a /reset has to be issued after receiving the 200 OK from this call.
Body
Media type: application/octet-stream
Type: any
/permission
This API allows to write lock/unlock the REST API With a user defined password.
/permission/token put delete
put /permission/token
Defines a write permission token (password)
Body
Media type: application/json
Type: any
Example:
{
"token": "foobar42"
}
HTTP status code 200
If the token was valid and successfully stored in the system.
Body
Media type: application/json
Type: any
Example:
{
"lock_set": true,
"allowed": true
}
HTTP status code 400
If the body was malformed, or the password token is not between 8 and 63 characters long.
HTTP status code 500
If the token cannot be stored in the system.
delete /permission/token
/permission/write get put delete
put /permission/write
Unlocks write access.
Body
Media type: application/json
Type: any
Example:
{
"token": "foobar42"
}
HTTP status code 200
The write lock was successfully removed.
Body
Media type: application/json
Type: any
Example:
{
"lock_set": true,
"allowed": true
}
HTTP status code 400
If the request body is malformed.
HTTP status code 401
If the given token is not valid.
HTTP status code 500
If not write token was defined.
/mavlink
/mavlink/status get
get /mavlink/status
Provides an array with status information for all available mavlink interfaces, e.g. port name, connection status, mavlink system id and injected GPS fix quality
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
[
{
"port": "JST",
"mav_connected": false,
"mav_sysid": 1,
"mav_compid": 160,
"mav_packets_received": 0,
"mav_fix3d": false,
"gnss_inject_timer_running": false,
"esp32_valid_timesync": false
}
]
HTTP status code 501
There are no mavlink interfaces on this device
/flarm
/flarm/status
/flarm/status/dataport get
/flarm/status/navigation get
get /flarm/status/navigation
Provides the current navigation solution that is available from GPS.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"heartbeat_counter": 13599,
"time_epoch": 0,
"longitude": 0,
"latitude": 0,
"alt_wgs84": 0,
"alt_egm96": 0,
"alt_baro": 603.808837890625,
"groundspeed_ms": 0,
"track_deg": 0,
"fix_valid": false
}
HTTP status code 500
If no the connection to the FLARM could not be obtained.
/flarm/status/heartbeat get
get /flarm/status/heartbeat
FLARM Heartbeat information, this correlates with the Dataport $PFLAU heartbeat message.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"counter": 13715,
"rx": 0,
"tx": false,
"gps": 0,
"power": true,
"alarm_level": 0,
"relative_bearing": 0,
"alarm_type": 0,
"relative_vertical": 0,
"distance": 0,
"id": 0
}
HTTP status code 500
If no the connection to the FLARM could not be obtained.
/flarm/status/error get
/flarm/status/aircraft get
get /flarm/status/aircraft
Provides the list of aircraft in the vicinity. This correlates with the Dataport $PFLAA message.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"12A5B2": { "heartbeat_counter": 1504, "id": "12A5B2", "id_type": 2, "alarm_level": 1, "relative_north": 4552, "relative_east": 2145, "relative_vertical": -240, "track_deg": 20, "turnrate": 0.2, "groundspeed": 40.2, "climbrate": 0.6, "acft_type": 6, "no_track": false, "source": 2, "rssi": 42 },
"43B7CC": { "heartbeat_counter": 1504, "id": "43B7CC", "id_type": 2, "alarm_level": 3, "relative_north": 552, "relative_east": 145, "relative_vertical": -40, "track_deg": 200, "turnrate": -0.24, "groundspeed": 68.2, "climbrate": 0.2, "acft_type": 1, "no_track": false, "source": 2, "rssi": 68 }
}
/flarm/status/version get
/flarm/status/flight get
/flarm/config put
put /flarm/config
Upload a flarm configuration file.
Body
Media type: application/text
Type: any
Example:
$PFLAC,S,ACFT,1
$PFLAC,S,PILOT,Wedge Antilles
$PFLAC,S,COPIL,Biggs Darklighter
/flarm/config/{item} get put
get /flarm/config/{item}
Query a FLARM configuration item.
URI Parameters
- item: required(string)
put /flarm/config/{item}
Write FLARM configuration item. Numbers MUST be written as json strings!
URI Parameters
- item: required(string)
Body
Media type: application/json
Type: any
Example:
65535
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
42
HTTP status code 400
Malformed request, non compliant json request body or the configuration item does not exist.
HTTP status code 401
Write lock is active.
HTTP status code 500
If no the connection to the FLARM could not be obtained.
/flarm/ob2 put
put /flarm/ob2
Upload a obstacle database including installation.
Body
Media type: application/octet-stream
Type: any
/flarm/fw put
put /flarm/fw
Upload a FLARM firmware file including installation.
Body
Media type: application/octet-stream
Type: any
/flarm/lics put
put /flarm/lics
Upload a FLARM license and install it on the Device.
Body
Media type: application/octet-stream
Type: any
/flarm/flash get
get /flarm/flash
Download an encrypted FLARM flash dump for analysis purposes. Careful the invocation of this endpoint will result in a ~5 minutes transaction!
/flarm/carp get delete
get /flarm/carp
Download the current CARP data. This selects the default CARP method, e.g. InstaCARP or (legacy) CARP.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"antenna_A_range": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"antenna_B_range": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"count": 0,
"first_contact": 0,
"last_contact": 0
}
/flarm/legacycarp get
get /flarm/legacycarp
Download the data from the (legacy) CARP method.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
{
"antenna_A_range": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"antenna_B_range": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"count": 0,
"first_contact": 0,
"last_contact": 0
}
/flarm/igc get
get /flarm/igc
Returns a list of available IGC flight record files meta data.
HTTP status code 200
Body
Media type: application/json
Type: any
Example:
[
{
"index": 0,
"filename": "051XCP71.IGC",
"timestamp": "2020-05-01T06:17:48",
"duration": "00:12:45",
"pilot": null,
"compid": null,
"class": null
},
{
"index": 1,
"filename": "04PXCP71.IGC",
"timestamp": "2020-04-25T10:10:42",
"duration": "00:19:39",
"pilot": null,
"compid": null,
"class": null
},
{
"index": 2,
"filename": "04JXCP71.IGC",
"timestamp": "2020-04-19T06:47:24",
"duration": "00:12:47",
"pilot": null,
"compid": null,
"class": null
},
{
"index": 3,
"filename": "04IXCP71.IGC",
"timestamp": "2020-04-18T10:05:48",
"duration": "00:20:46",
"pilot": null,
"compid": null,
"class": null
},
{
"index": 4,
"filename": "049XCP71.IGC",
"timestamp": "2020-04-09T09:00:21",
"duration": "00:12:35",
"pilot": null,
"compid": null,
"class": null
},
{
"index": 5,
"filename": "014XCP71.IGC",
"timestamp": "1970-01-04T19:33:10",
"duration": "00:12:34",
"pilot": null,
"compid": null,
"class": null
},
{
"index": 6,
"filename": "29RXCP7E.IGC",
"timestamp": "1970-01-01T00:55:40",
"duration": "00:12:28",
"pilot": "Michael Mimo Moratti",
"compid": null,
"class": null
},
{
"index": 7,
"filename": "29RXCP7D.IGC",
"timestamp": "1970-01-01T00:22:24",
"duration": "00:18:18",
"pilot": "Michael Mimo Moratti",
"compid": null,
"class": null
},
{
"index": 8,
"filename": "29RXCP7C.IGC",
"timestamp": "1970-01-01T01:19:04",
"duration": "00:12:28",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 9,
"filename": "019XCP71.IGC",
"timestamp": "1970-01-09T17:41:02",
"duration": "00:12:37",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 10,
"filename": "019XCP71.IGC",
"timestamp": "1970-01-09T16:31:44",
"duration": "00:15:42",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 11,
"filename": "017XCP71.IGC",
"timestamp": "1970-01-07T19:34:30",
"duration": "00:13:14",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 12,
"filename": "015XCP71.IGC",
"timestamp": "1970-01-05T19:57:19",
"duration": "00:12:29",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 13,
"filename": "015XCP71.IGC",
"timestamp": "1970-01-05T19:15:22",
"duration": "00:22:49",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 14,
"filename": "015XCP71.IGC",
"timestamp": "1970-01-05T18:52:37",
"duration": "00:24:49",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 15,
"filename": "015XCP71.IGC",
"timestamp": "1970-01-05T17:43:43",
"duration": "01:04:43",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 16,
"filename": "015XCP71.IGC",
"timestamp": "1970-01-05T16:47:27",
"duration": "00:23:04",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 17,
"filename": "014XCP71.IGC",
"timestamp": "1970-01-04T02:27:33",
"duration": "00:12:30",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 18,
"filename": "29RXCP72.IGC",
"timestamp": "1970-01-01T00:49:53",
"duration": "00:12:28",
"pilot": "Darth Vader",
"compid": null,
"class": null
},
{
"index": 19,
"filename": "018XCP71.IGC",
"timestamp": "1970-01-08T17:14:34",
"duration": "00:18:03",
"pilot": "Darth Vader",
"compid": null,
"class": null
}
]
HTTP status code 500
If no the connection to the FLARM could not be obtained
/flarm/igc/{index} get
get /flarm/igc/{index}
Returns the text based IGC data as a chunked HTTP response.
URI Parameters
- index: required(string)
/flarm/igc/simulation get post
get /flarm/igc/simulation
Retrieve the currently running simulation scenario, if any.
post /flarm/igc/simulation
Start the requested simulation scenario.
Body
Media type: application/json
Type: any
Example:
1
HTTP status code 200
The requested simulation scenario was started. Returns the started scenario.
Body
Media type: application/json
Type: any
Example:
1
HTTP status code 400
An invalid request was made. Potentially the device state does not allow for a scenario to be run (in flight, another scenario already running). See message for more information.
HTTP status code 404
The given scenario number does not exist.
HTTP status code 500
Internal error while starting the requested scenario.
/remoteid
/power
/power get
get /power
Available on PowerFLARM Flex. Provides the power state of the device.