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