This repository was archived by the owner on May 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Flattr API
Thomas Greiner edited this page Mar 13, 2018
·
1 revision
All events are expected to be dispatched on the Document object on any page on flattr.com.
The extension should indicate that it is installed by using sessionStorage to set the key to "extension" and the value to the extension's version string.
Furthermore, the extension should dispatch a "flattr-installed" event when its content script gets loaded and a "flattr-uninstalled" event when its content script gets unloaded.
- Webpage starts Handshake
- Extension dispatches "flattr-authenticated" event
- boolean authenticated
- Extension opens webpage in new tab when user clicks the "Sign in" button
- Webpage starts Handshake
- Extension closes tab
- Extension attempts to submit flattrs
- Server responds with status
401 Unauthorized - Extension removes stored token
- Webpage dispatches "flattr-trigger" event
- string action ("authentication")
- Extension dispatches "flattr-authenticate" event
- string build – This is the build ID.
- string id – This is the extension ID.
- string version – This is the extension version.
- Webpage dispatches "flattr-token" event
- string accessToken
- Subscription subscription
- Extension stores the token and updates the subscription accordingly
- Webpage dispatches "flattr-subscription" event
- Subscription subscription
- Extension updates the subscription accordingly
- Extension attempts to submit Flattrs
- Server responds with status
402 Payment Required - Extension deactivates the currently active subscription
- boolean active
The extension should submit flattrs as soon as it determines which URL to flattr and it should retry the submission in the case of any of the following network errors:
- 408 Request Timeout
- 409 Conflict
- 500 Internal Server Error
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Time-out
- 525 SSL Handshake Failed
- 599 Network Connection Timeout Error
API Endpoint: https://api.flattr.com/rest/v2/flattr/bulk
Method: POST
Headers:
Content-Type: application/json
Authorization: Bearer <token>
Body:
[
{
"url": "<url>"
},
...
]