API Methods
All content published on Dystopiatracker.com is provided under a BY-SA Creative Commons License, which means you can use it free of charge for whatever purpose as long as you give credit to the Dystopia Tracker and share your work with the same license.
For the time being, the API is read-only. If you want to build something that requires write-access, please get in touch with david@dystopiatracker.com.
###Endpoint for list of predictions: api/predictions
Returns a (paginated) lists of predictions, latest first (based on creation_date).
parameter | description | expected values |
---|---|---|
lang | Returns all predictions for which a description in the queried language | E for English, D for German |
editors_pick | Returns all predictions highlighted as editors' pick | True, False |
category | Returns all predictions from a specific category (6=State&Control, 7=Body&Mind, 8=Relationships&Communication, 9=Work&Business, 10=Leisure & Entertainment, 11=Cities&Environment, 12=War&Geopolitics, 13=other) | id |
source_type | Returns all predictions from a specific source type | literature, movies, tv_series, games, other |
title | Returns all predictions for a specific source | sting |
author | Returns all predictions by a specific creator | string |
exclude | Excludes a specific prediction from the list by id | integer |
page | the list is paginated, 50 predictions per page. defaults to 1 | integer |
limit | Limits the number of predictions to return | integer |
img | Returns all predictions where img_url is not empty | True, False |
incomplete | Returns all predictions where at least one field is empty | True, False |
Examples
-
All Editors' picks in English
GET api/predictions/?lang=E&editors_pick=True
-
All predictions about state & control in literature
GET api/predictions/?category=6&type=literature
-
Example: all predictions in German except the one with id=77
GET api/predictions/?lang=de&exclude=77
###Endpoint for single prediction: api/prediction/<id>
Returns a prediction object including all information on its source and including an array of realisations of said prediction.
###Endpoint for list of sources: api/source
Returns a (paginated) lists of sources.
parameter | description | expeced values |
---|---|---|
type | returns all sources by a specific type | literature, movies, tv-series, games,other |
page | the list is paginated, 50 sources per page. defaults to 1 | integer |
limit | Limits the number of predictions to return | integer |
img | Returns all sources that have a image attached | True, False |
###Endpoint for single source: api/source/<id>
Returns a source object.
Again, please note that for the time being, the public API is read-only. If you want to build something that requires write-access, please get in touch with david@dystopiatracker.com.
###Endpoint for creating new predictions, realisations and sources: api/<type>
parameter | description | required? |
---|---|---|
type | prediction or realisation or source | required |
source_id | if a new prediction is created, this is the ID of the source it is connected to | required (if type==prediction) |
prediction_id | if a new realisation is created, this is the ID of the prediction it should be connected to | required (if type==realisation) |