50 lines
2.3 KiB
HTML
50 lines
2.3 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 superlogin %}?next={% firstof request.get_full_path|urlencode '/' %}"><span>sign in</span></a> first.</p>
|
|
{% endif %}
|
|
|
|
<h3>Basic API info</h3>
|
|
|
|
<a href="/api/v1/?format=json">Available Resources (JSON)</a>
|
|
|
|
<p>
|
|
Resources on this list can be accessed via {{ base_url }}/api/v1/{resource_on_list}/?format=json&api_key={your_api_key}&username={your_username} .
|
|
</p>
|
|
|
|
<p>
|
|
Works can be ordered by how often they've been favorited; append &order_by=num_wishes (ascending) or &order_by=-num_wishes (descending).
|
|
</p>
|
|
|
|
{% 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={your_api_key}&username={your_username}</a>
|
|
<h3>Identifier Resolution</h3>
|
|
<p>JSON to get work/edition data for an isbn</p>
|
|
<a href="/api/v1/identifier/?format=json&api_key={{api_key}}&username={{user.username}}&type=isbn&value=9780441012039">{{base_url}}/api/v1/identifier/?format=json&api_key={your_api_key}&username={your_username}&type=isbn&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 %}
|
|
|
|
|