regluit/api/templates/api_help.html

42 lines
1.8 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&amp;api_key={{api_key}}&amp;username={{user.username}}">{{base_url}}/api/v1/campaign/?format=json&amp;api_key={api_key}&amp;username={username}</a>
<h3>Identifier Resolution</h3>
<p>JSON to get work/edition data for an isbn</p>
<a href="/api/v1/identifier/?format=json&amp;api_key={{api_key}}&amp;type=isbn&amp;value=9780441012039">{{base_url}}/api/v1/identifier/?format=json&amp;api_key={api_key}&amp;ype=isbn&amp;value=9780441012039</a>
<p> In addition to isbn, you can use 'goog' if you have a google books id, and 'oclc' for oclc numbers.</p>
{% 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 %}