Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add documentation page for REST API

Roland Geider4f54e69fded6
diff --git a/wger/manager/templates/navigation.html b/wger/manager/templates/navigation.html
index a5b0aef63..e851f14ec 100644
--- a/wger/manager/templates/navigation.html
+++ b/wger/manager/templates/navigation.html
@@ -110,6 +110,7 @@
<li class="divider"></li>
<li class="nav-header">{% trans "Developers" %}</li>
<li><a href="{% url 'software:code' %}">{% trans "Get the code" %} </a></li>
+ <li><a href="{% url 'software:api' %}">{% trans "REST API" %} </a></li>
<li><a href="{% url 'software:license' %}">{% trans "License" %} </a></li>
<li><a href="{% url 'software:changelog' %}">{% trans "Changelog" %} </a></li>
<li><a href="https://github.com/rolandgeider/wger">{% trans "Github" %} </a></li>
diff --git a/wger/software/templates/api.html b/wger/software/templates/api.html
new file mode 100644
index 000000000..f7b94df13
--- /dev/null
+++ b/wger/software/templates/api.html
@@ -0,0 +1,33 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+
+{% block title %}{% trans "REST API" %}{% endblock %}
+
+{% block content %}
+<p>{% blocktrans %}wger Workout Manager provides a full REST API to all database
+objects:{% endblocktrans %} <a href="/api/v1/?format=json">/api/v1/</a></p>
+
+<p>{% blocktrans %}Public endpoints, such as the list of exercises or the
+ingredients can be accessed without authentication. For user owned
+objects such as workouts, you need to generate an API KEY and pass it
+along with the username either in the header or in form of GET parameters.{% endblocktrans %}</p>
+
+<p>{% blocktrans %}The API uses HATEOAS, so you should be able to browse
+through the necessary endpoints without having to consult an extensive
+documentation. At the moment, the API only supports read operations, but
+support for full POST/PUT/DELETE/PATCH is planned for the near future.{% endblocktrans %}</p>
+
+<div class="alert alert-info" style="margin-top:1em;">
+{% blocktrans %}This is also new for us, if you plan on using the API,
+<a href="https://groups.google.com/group/wger">we'd love to hear from you</a>.{% endblocktrans %}
+</div>
+{% endblock %}
+
+
+{% block sidebar %}
+<p><a href="/api/v1/?format=json" class="btn btn-block">{% trans "Browse the API" %}</a></p>
+<p><a href="{% url 'api-key' %}" class="btn btn-block">Generate API KEY</a></p>
+{% endblock %}
\ No newline at end of file
diff --git a/wger/software/urls.py b/wger/software/urls.py
index 72e64f8b1..f6e8ae82c 100644
--- a/wger/software/urls.py
+++ b/wger/software/urls.py
@@ -40,8 +40,12 @@ urlpatterns = patterns('',
url(r'^code$',
ContextTemplateView.as_view(template_name="code.html"),
name='code'),
-
+
url(r'^contribute$',
TemplateView.as_view(template_name="contribute.html"),
name='contribute'),
+
+ url(r'^api$',
+ TemplateView.as_view(template_name="api.html"),
+ name='api'),
)