OpenCPN Partial API docs
|
Opencpn REST API. More...
#include <rest_server.h>
Public Member Functions | |
virtual bool | StartServer (const fs::path &certificate_location)=0 |
Start the server thread. | |
virtual void | StopServer ()=0 |
Stop server thread, blocks until completed. | |
virtual std::string | GetEndpoint ()=0 |
Return HTTPS url to local rest server. | |
Public Attributes | |
EventVar | activate_route |
Notified with a string GUID when user wants to activate a route. | |
EventVar | reverse_route |
Notified with a string GUID when user wants to reverse a route. | |
Opencpn REST API.
Supported endpoints:
GET /api/ping?api_key=<pincode>
&source=<ip address>
Basic ping check, verifies api_key i. e., the pairing.
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.<code>
, "version": <version>
} <version>
is a printable version like 5.9.0POST /api/rx_object?api_key=<pincode>
&source=<ip address>
&force=1
Upload GPX route(s), track(s) or waypoint(s).
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.<1>
if present, the host object is unconditionally updated. If not, host may run a "OK to overwrite" dialog.<1>
Optional, activate route or waypoint after transfer<code>
}GET /api/writable?guid=<guid>
Check if route or waypoint with given guid is writable.
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.<guid>
Route, waypoint or track guid.<code>
}GET /api/get-version
Return current server version string. Does not require api_key or source.
GET /api/list-routes
Return list of available routes
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.GET /api/activate-route
Activate an existing route.
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.<guid>
Route guid.<code>
}GET /api/reverse-route
Reverse an existing route
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.<guid>
Route guid.<code>
}POST /api/plugin-msg Upload string message forwarded to all plugins
<ip>
Mandatory, origin ip address or hostname.<key>
Mandatory, as obtained when pairing, see below.<id>
Mandatory, message id used by listeners.<code>
}Authentication uses a pairing mechanism. When an unpaired device tries to connect, the API generates a random pincode which is sent to the connecting party where it is displayed to user. User must then input the pincode in the server-side GUI thus making sure she has physical access to the server.
Result codes are as defined in RestServerResult.
Definition at line 221 of file rest_server.h.