Quick overview on how to communicate with Fleep via API.
Fleep API consists of JSON requests and responses over HTTPS, API endpoints are in form https://fleep.io/api/METHOD.
Accept-Encoding: gzip
the result may be optionally
compressed.API access is authenticated via token which identifies a Fleep user. To request token use https://fleep.io/api/account/login method.
Example
>>> import requests
>>>
>>> r = requests.post("https://fleep.io/api/account/login",
... json={"email": "user@domain.com", "password": "xxxx"})
>>>
>>> print r.json()["ticket"]
d5a9c3c2fc696c4a4b55
>>>
>>> print r.cookies["token_id"]
dd737a29-7819-41dc-ad93-a38aab2c9409
To retrieve Fleep messages and events use https://fleep.io/api/account/poll.
Example
>>> r = requests.post("https://fleep.io/api/account/poll",
... cookies={"token_id": "dd737a29-7819-41dc-ad93-a38aab2c9409"},
... json={"wait": False, "event_horizon": 0, "ticket": "d5a9c3c2fc696c4a4b55"})
To post messages to Fleep use https://fleep.io/api/event/store.
Example
>>> data = {
... "ticket": "6528701a3f619b6aa001",
... "api_version": 4,
... "stream": [{
... "client_req_id": "84d73134-ca41-4dda-b818-f724f42cd79e",
... "mk_event_type": "urn:fleep:client:message:add_plain",
... "params": {
... "conversation_id": "3c2c8dee-02c6-4280-9306-d76a932cd79e",
... "message": "Hello world!"}}]}
>>>
>>> r = requests.post("https://fleep.io/api/event/store",
... cookies={"token_id": "dd737a29-7819-41dc-ad93-a38aab2c9409"},
... json=data)