Usage

API

The API serves two endpoints:

  1. POST /api/v1/task/ allows you to create a new processing task, providing only a remote IIIF JSON manifest URL,

  2. GET /api/v1/task/<TASK_ID>/ gives the current state of a given task, with a full result payload when available.

No authentication is required to use these endpoints.

With Python

Here are examples on how to use the API with Python and the requests library.

import requests
import time

# Create a new task
resp = requests.post("http://localhost:8000/api/v1/task/", json={"iiif_manifest_url": "https://gallica.bnf.fr/iiif/ark:/...."})
resp.raise_for_status()
data = resp.json()

print(f"Started task {data['id']}")
url = data['url']

# Wait for result
while data['state'] not in ("error", "completed"):
    resp = requests.get(url)
    resp.raise_for_status()
    data = resp.json()
    print(data['state'])
    time.sleep(1)

API documentation

A full API reference is available directly on your instance at the /api/doc/ url.

api doc

HTML client

Using your web browser on the /api/v1/task/ endpoint will give you access to an HTML client that you can use to start a new task.

html client

Administration interface

An administration web interface is available at the /admin/ url, using your web browser and the credentials created by the django-admin createsuperuser command during deployment.

admin

From that interface, you can:

  • manage users

  • create new tasks manually

  • view all existing tasks