api info page, some api fixes
[wolnelektury.git] / apps / api / templates / api / main.html
1 {% extends "base.html" %}
2 {% load i18n %}
3
4 {% block title %}{% trans "WolneLektury.pl API" %}{% endblock %}
5
6 {% block bodyid %}api{% endblock %}
7
8 {% block body %}
9
10 <h1>API</h1>
11
12 <p>
13 {% blocktrans %}
14 WolneLektury.pl API resides under <code>http://www.wolnelektury.pl/api/</code>.
15 You can use it to access information about books, their fragments and
16 their metadata.
17 {% endblocktrans %}
18 </p>
19
20 <p>
21 {% blocktrans %}
22 Default data serialization format is
23 <a href="http://en.wikipedia.org/wiki/JSON">JSON</a>,
24 but you can also use XML by appending <code>?format=xml</code>
25 query parameter to each URL.
26 {% endblocktrans %}
27 </p>
28
29 <p>
30 {% blocktrans %}
31 The URLs in WolneLektury.pl API are:
32 {% endblocktrans %}
33 </p>
34
35 <ul>
36     <li><a href='/api/books/'>/api/books/</a> – {% trans "List of all books" %}
37
38     <li><a href='/api/authors/'>/api/authors/</a> – {% trans "List of all authors" %}</li>
39     <li><a href='/api/epochs/'>/api/epochs/</a> – {% trans "List of all epochs" %}</li>
40     <li><a href='/api/genres/'>/api/genres/</a> – {% trans "List of all genres" %}</li>
41     <li><a href='/api/kinds/'>/api/kinds/</a> – {% trans "List of all kinds" %}</li>
42
43     <li><a href='/api/themes/'>/api/themes/</a> – {% trans "List of all themes" %}</li>
44 </ul>
45
46 <p>
47 {% url api_book "studnia-i-wahadlo" as e1 %}
48 {% url api_tag "authors" "edgar-allan-poe" as e2 %}
49 {% blocktrans %}
50 Each element of those lists contains a link (in a "href") attibute
51 which points to individual resource's details, i.e.:
52 <a href="{{e1}}">{{e1}}</a> or
53 <a href="{{e2}}">{{e2}}</a>.
54 {% endblocktrans %}
55 </p>
56
57 <p>
58 {% blocktrans with "/api/authors/adam-mickiewicz/kinds/liryka/books/" as e %}
59 You can combine authors, epochs, genres and kinds to find only books matching
60 those criteria. For instance:
61 <a href="{{e}}">{{e}}</a>.
62 {% endblocktrans %}
63 </p>
64
65 <p>
66 {% blocktrans with "/api/authors/adam-mickiewicz/kinds/liryka/parent_books/" as e %}
67 If you only want top-level books and not all the children, you can use /parent_books/, as in:
68 <a href="{{e}}">{{e}}</a>.
69 {% endblocktrans %}
70 </p>
71
72 <p>
73 {% url api_fragment "sen-nocy-letniej" "1290526312912-3814598192" as f %}
74 {% blocktrans with "/api/authors/william-shakespeare/themes/zabawa/fragments/" as e %}
75 The same way, using also books and themes, you can search for a list of fragments:
76 <a href="{{e}}">{{e}}</a>. 
77 Again, each entry has a "href" attribute which links to the fragment's details, i.e.:
78 <a href="{{f}}">{{f}}</a>. 
79 {% endblocktrans %}
80 </p>
81
82 {% endblock %}