Translations of this page:

REST API Documentation

Wikibadges.org has a REST API available for searching badges created in the service. This API does not require authentication. All responses are in JSON format.

Following operations are supported:

Search badges

GET https://wikibadges.org/api/badge

Query parameters:

Parameter Type Description
lang String Filter by language
q String Search text

Available languages: de, en, es, fr, fi

Example response:

{
  "result": [
    {
      "id": "en:badge:example_id",
      "mtime": 1234567899
    },
    {
      "id": "en:badge:example_id_2",
      "mtime": 1234567898
    },
    ...
  ]
}

Get badge preview by id

GET https://wikibadges.org/api/badge/{badge-id}/preview

NOTE: Appropriate HTML data sanitization must be applied before using preview content.

Example response:

{
  "preview": "<h1>Example Badge</h1>..."
}

Get badge by id

GET https://wikibadges.org/api/badge/{badge-id}

Example response:

{
  "@context": "https://w3id.org/openbadges/v2",
  "type": "BadgeClass",
  "id": "https://wikibadges.org/api/badge/{badge-id}",
  "name": "Example badge",
  "description": "...",
  "image": "data:image/png;base64...",
  "criteria": {
    "id": "https://wikibadges.org/doku.php?id={badge-id}",
    "narrative": "..."
  },
  "tags": ["tag1", "tag2"]
}