{% extends 'basedocumentation.html' %} {% block title %}API Help{% endblock %} {% block doccontent %}
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.
{% if user.is_authenticated %}Welcome {{user.username}}. Your API key is {{api_key}}.
{% else %}Please sign in first.
{% endif %}You don't need an API key to embed Ebook (HTML) widgets.
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} .
Works can be ordered by how often they've been favorited; append &order_by=num_wishes (ascending) or &order_by=-num_wishes (descending).
With an API key, you can check if there's a free ebook for any ISBN. ISBNs can be 10 or 13 digits, and can include dashes. This service returns all free-licensed ebooks for a work associated with an ISBN, and for each ebook includes information about file type, rights, and the provider hosting the file.
For example, here's how to get a list of ebook files for "Homeland".
{% if user.is_authenticated %}
JSON: {{base_url}}/api/v1/free/?isbn=9780765333698&format=json&api_key={your_api_key}&username={your_username}
XML: {{base_url}}/api/v1/free/?isbn=9780765333698&format=xml&api_key={your_api_key}&username={your_username}
{% else %}
(Log in to see links)
{% endif %}
Here's how to get work/edition data for an isbn
{% if user.is_authenticated %}
JSON: {{base_url}}/api/v1/identifier/?format=json&api_key={your_api_key}&username={your_username}&type=isbn&value=9780441012039
XML: {{base_url}}/api/v1/identifier/?format=xml&api_key={your_api_key}&username={your_username}&type=isbn&value=9780441012039
Here's how to get data on all campaigns. if the user is logged in to Unglue.it, they can tell if the campaign book is on their fave list
JSON: {{base_url}}/api/v1/campaign/?format=json&api_key={your_api_key}&username={your_username}<
XML: {{base_url}}/api/v1/campaign/?format=json&api_key={your_api_key}&username={your_username}
Here's how to get work/edition data for an isbn
JSON: {{base_url}}/api/v1/identifier/?format=json&api_key={your_api_key}&username={your_username}&type=isbn&value=9780441012039
XML: {{base_url}}/api/v1/identifier/?format=xml&api_key={your_api_key}&username={your_username}&type=isbn&value=9780441012039
In addition to isbn, you can use 'goog' if you have a google books id, and 'oclc' for oclc numbers.
{% endif %}We have a basic implementation of OPDS feeds. You don't need a key to use them. The starting point is {{base_url}}{% url 'opds' %}
Examples:
{{base_url}}{% url 'opds_acqusition' 'epub' %}
{{base_url}}{% url 'opds_acqusition' 'by-sa' %}
{{base_url}}{% url 'opds_acqusition' 's.open' %}
{{base_url}}{% url 'opds_acqusition' 'kw.fiction' %}
{{base_url}}{% url 'opds_acqusition' '@eric' %}
There's also an OPDS record available for every work on unglue.it. For example, requesting, {{base_url}}{% url 'opds_acqusition' 'all'%}?work=13950
get you to the web page or opds record for A Christmas Carol.
There is an ONIX 3.0 feed corresponding to every facet of our free ebook lists. You don't need a key to use them. There is a maximum of 100 books per result you can change with the max parameter. For example, here are the first hundred CC BY-ND-ND licensed books available in EPUB.
There's also an ONIX record available for every free ebook on unglue.it. For example, here is Issues in Open Research Data.
There's a URI to identify every work used in OPDS feeds. HTTP content negotiation is used for these ids, so requesting application/atom+xml;profile=opds-catalog;kind=acquisition
for {{base_url}}{% url 'work_identifier' '13950' %}
get you to the web page or opds record for A Christmas Carol. requesting text/xml
gets you the onix record. Otherwise, you get the normal html page.