regluit/api/templates/api_help.html

38 lines
1.4 KiB
HTML

{% extends "basedocumentation.html" %}
{% block title %}API Help{% endblock %}
{% block doccontent %}
<h2>API Help</h2>
<p>Some of the data from Unglue It is avaiable via a JSON API. You will need a key and username to be able to use the API.
</p>
{% if user.is_authenticated %}
<p> Welcome {{user.username}}. Your API key is <span style="font-weight:bold">{{api_key}}</span>.</p>
{% else %}
<p> Please <a href="{% url auth_login %}?next={% firstof request.path '/' %}"><span>sign in</span></a> first.</p>
{% endif %}
<h3>Basic API info</h3>
<a href="/api/v1/?format=json">Available Resources (JSON)</a>
{% if user.is_authenticated %}
<h3>Campaign info</h3>
<p>JSON to get data on all campaigns</p>
<a href="/api/v1/campaign/?format=json&api_key={{api_key}}&username={{user.username}}">{{base_url}}/api/v1/campaign/?format=json&api_key={api_key}&username={username}</a>
{% endif %}
<h3>Campaign Widgets</h3>
<p>You don't need a key to embed campaign (HTML) widgets. </p>
{% if campaign %}
Here's a sample widget for the book <span style="font-style: italic">{{campaign.name}}</span> with ISBN {{campaign_isbn}}: <a href="{% url widget campaign_isbn %}">{{base_url}}{% url widget campaign_isbn %}</a>
{% else %}
<p>Since there are currently no campaigns, there are no corresponding widgets.</p>
{% endif %}
{% endblock %}