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