Create syncthing-event-api(7)

This commit is contained in:
Stefan Tatschner
2015-05-29 16:39:22 +02:00
parent 855a77234f
commit 0215ab696a
+30 -19
View File
@@ -1,8 +1,11 @@
Event API Event API
========= =========
Syncthing provides a simple long polling interface for exposing events from Description
the core utility towards a GUI. -----------
Syncthing provides a simple long polling interface for exposing events from the
core utility towards a GUI.
To receive events, perform a HTTP GET of ``/rest/events?since=<lastSeenID>``, To receive events, perform a HTTP GET of ``/rest/events?since=<lastSeenID>``,
where ``<lastSeenID>`` is the ID of the last event you've already seen or zero. where ``<lastSeenID>`` is the ID of the last event you've already seen or zero.
@@ -26,28 +29,36 @@ Event Structure
Each event is represented by an object similar to the following:: Each event is represented by an object similar to the following::
{ {
"id": 2, "id": 2,
"type": "DeviceConnected", "type": "DeviceConnected",
"time": "2014-07-13T21:04:33.687836696+02:00", "time": "2014-07-13T21:04:33.687836696+02:00",
"data": { "data": {
"addr": "172.16.32.25:22000", "addr": "172.16.32.25:22000",
"id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG" "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
} }
} }
The top level keys ``id``, ``time``, ``type`` and ``data`` are always present, though ``data`` may be ``null``. The top level keys ``id``, ``time``, ``type`` and ``data`` are always present,
though ``data`` may be ``null``.
* ``id`` is a monotonically increasing integer. The first event generated has id ``1``, the next has id ``2`` etc. id
* ``time`` is the time the event was generated. A monotonically increasing integer. The first event generated has id ``1``,
* ``type`` indicates the type of (i.e. reason for) the event and is one of the event types below. the next has id ``2`` etc.
* ``data`` is an object containing optional extra information; the exact structure is determined by the event type. time
The time the event was generated.
type
Indicates the type of (i.e. reason for) the event and is one of the event
types below.
data
An object containing optional extra information; the exact structure is
determined by the event type.
Events Events
------ ------
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
:glob: :glob:
../events/* ../events/*