Skip to content

Endpoints

Michael Beaton edited this page Nov 2, 2022 · 4 revisions

This page describes the endpoints provided by django-wm. See here for information on setting up urlpatterns metadata for your views.

Setup

For django-wm to work, you will need to include its URLs to your project's urlpatterns. The path route is arbitrary, but webmention/ will be assumed throughout this documentation for simplicity.

# your_project/urls.py
urlpatterns = [
    ...
    path("webmention/", include("mentions.urls")),
]

This will make the following endpoints accessible.

/webmention/

If someone wants to send you a webmention, this is where they will send it. To help them find it you should enable the provided middleware and add {% webmentions_endpoint %} to your templates.

/webmention/get/

JSON API endpoint for retrieving webmentions for a page from your frontend.

Requires url query parameter with the value of window.location.pathname.

Sample JSON response
// /webmention/get?url=/my-article

{
  "target_url": "https://my-site.org/my-article",
  "mentions": [
    {
      "hcard": {
        "name": "Jane Bloggs",
        "avatar": "https://gravatar.com/janebloggs",
        "homepage": "https://jane-bloggs-example.org"
      },
      "quote": null,
      "source_url": "https://jane-bloggs-example.org/some-article",
      "published": "2020-01-17T21:45:24.542Z",
      "type": "webmention"
    }
  ]
}

Live sample

/webmention/dashboard/

Provides a simple overview of the most recent webmention activity. By default this is only accessible to users with permission.