The Extension:OttrParser comes with an API to import and export .stotter files.

Comprehensive documentation can be found on the main page of the running instance, this will most likely be http://localhost:5000/.

Settings Edit

An example config is included. You need to insert your own wikiurl.


# relative or absolute path to logifle

# python logging library ligging level.

# The base url of you mediawiki, needs to end with a '/' !
# The example is applicable for a mediawiki with main page url 'http://localhost/mediawiki-1.37.1/index.php/Main_Page'

# Get these from you mediawikis Special:BotPasswords page.
# The option $wgEnableBotPasswords must be set to true in the Localsettings.php

# More on this here:
bot_user_name=Oliver Tautz@ottrbot

Change values as desired. Afterward, you can start the API.

Start the API Edit


python3 /includes/ottrToSmwPython/ --config /path/to/config

with your config file to start the API. You can then find more docs at http://localhost:5000/.

Bot Passwords (Optional) Edit

To use the API you can use Mediawiki-API credentials. For this, you must enable Bot Passwords by adding


to you LocalSettings.php. Afterwards go to the Special:BotPasswords page of your wiki, create a new bot password and write down the username and password.

This way all edits will be done by a single user. Otherwise they will be done by a user without login.

Export Edit

The API provides 4 endpoints to export .stottr data from mediawiki:


All endpoints can be accessed with a simple get request :

curl -X 'GET' \
  'http://localhost:5001/ottr_get/api/get_templates' \
  -H 'accept: application/json'

and return a JSON object of the form

  "templates": "string",
  "instances": "string",
  "prefixes": "string"

containing valid .stottr syntax strings.

Import Edit

To import all data from a .stottr file into the wiki the endpoint


is used. A minimal example in python looks like this:

import requests

file = open('stottr_file.stotter')
data =

body = {"data": data,
        "template_namespace": "Template",
        "instance_namespace": "",

r ="",json=body)


data contains a full .stottr file as string.

template_namespace and instance_namespace can be set to put imported templates or instances in a namespace.

overwrite can be set to overwrite existing pages. If set to False, existing pages will not be updated.

The API will do the following things when importing: Edit

  • Create a new wikipage for each template in the .stotter file
  • Create a new wikipage for each instance in the .stotter file
  • Add prefixes present in the .stottr file to the Ottr:OttrPrefixes page
  • create list entries in the Special:OttrApiEdits page