This repository has been archived by the owner on Feb 1, 2018. It is now read-only.
/
documentation.html
131 lines (117 loc) · 3.84 KB
/
documentation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{% extends "crashstats_base.html" %}
{% block page_title %}API Documentation{% endblock %}
{% block product_nav_filter %} {% endblock %}
{% block site_css %}
{{ super() }}
<style type="text/css">
p.url { margin: 15px; font-size: 1.6em; }
p.url code { padding-left: 25px; }
th.fixed, td.fixed { width: 15%; }
div.run-test { text-align: right; margin: 10px; }
a.collapse-list, a.expand-list { text-decoration: none; font-weight: bold; padding: 3px; }
input.error { border: 2px solid red; }
div.test-drive { display: none; }
button.close { display: none; }
.status-error { display: none; color: red; font-weight: bold; }
pre.docstring { background-color: rgb(225,225,225); padding: 6px; }
</style>
{% endblock %}
{% block site_js %}
{{ super() }}
{% compress js %}
<script type="text/javascript" src="{{ static('api/js/testdrive.js') }}"></script>
{% endcompress %}
{% endblock %}
{% block content %}
<div id="mainbody">
<div class="page-heading">
<h2>API Documentation</h2>
</div>
<div class="panel">
<div class="body notitle">
<p>
These API endpoints are publically available. The parameters to some endpoints
are non-trivial as some might require deeper understanding of the Soccoro backend.
</p>
<p>
<b>Note:</b> All Personal Identifiable Information
will be <b>removed or scrubbed</b> from all responses.
</p>
</div>
</div>
{% for endpoint in endpoints %}
<div class="panel">
<div class="title">
<h2>{{ endpoint.name }}</h2>
</div>
<div class="body">
<form class="testdrive">
<p class="url">
<strong>{{ ' | '.join(endpoint.methods) }}</strong>
<code>{{ base_url }}{{ endpoint.url }}</code>
</p>
{% if endpoint.docstring %}
<p class="docstring">Documentation notes</p>
<pre class="docstring">{{ endpoint.docstring }}</pre>
{% endif %}
{% if endpoint.parameters %}
<table class="data-table vertical">
<thead>
<tr>
<th class="fixed">Parameter key</th>
<th class="fixed">Required?</th>
<th class="fixed">Type</th>
<th class="fixed">Default</th>
<th>Test drive</th>
</tr>
</thead>
<tbody>
{% for parameter in endpoint.parameters %}
<tr>
<td class="fixed"><strong>{{ parameter.name }}</strong></td>
<td class="fixed">
{% if parameter.required %}Required
{% else %}Optional
{% endif %}
</td>
<td class="fixed">
{{ describe_friendly_type(parameter['type']) }}
</td>
<td class="fixed">
<code>{{ endpoint['defaults'].get(parameter['name'], '') }}</code>
</td>
<td>
{{ make_test_input(parameter, endpoint['defaults']) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p><em>Takes no parameters</em></p>
{% endif %}
<!-- for starting a test drive -->
<div class="run-test">
<button type="submit">Run Test Drive!</button>
<button type="button" class="close">× Close</button>
</div>
<div class="test-drive">
<p class="status-error">
An error happened on the server when trying this URL.
</p>
<p class="used-url">
<strong>Using</strong><br>
<a href=""><code></code></a>
</p>
<p class="status">
Status <code></code>
</p>
<p><strong>Output:</strong></p>
<pre></pre>
</div>
</form>
</div>
</div>
{% endfor %}
</div>
{% endblock %}