Extension:Math/RESTBase

= Configure Restbase to work with the Math extension = To install mathoid and restbase to work with the math extension the following steps are required:

Mathoid
edit config.yaml as follows run mathoid as a screen session

testing mathoid
Now the following test curl -d 'q=E=mc^2' localhost:10042/mml should return

RESTBase
edit config.yaml as follows run restbase as a screen session

testing restbase
Navigate to http://localhost:8081/wikimedia.org/v1/?doc you should be able to enter a texvc formula to the check command POST endpoing i.e. /media/math/check/{type}  (See screenshot 1) In the response headers you should find something like "x-resource-location": "4c0004393a88f350a93bcef62106d556c7fc827b" If you copy the value 4c0004393a88f350a93bcef62106d556c7fc827b and paste it to the GET endpoint /media/math/render/{format}/{hash} as value you should be able to see the PNG image if you select that as an output format. (See screenshot 2)

Configuration Example for arbitrary domain in RESTBase setup
If you want to use domain other than wikimedia.org, you can follow below example;

you can test the APIs at http://your.some.domain/your.some.domain/v1/
 * mathoid/config.yaml
 * restbase/config.yaml
 * restbase/project/MR.yaml
 * restbase/v1/mathoid.yaml
 * Apache proxy config : /etc/httpd/conf.d/restbase.conf

setup apache proxy
To load the images from the same location where the main wiki site is hosted a simple apache proxy can be used. Enable apache mod proxy ... and then add a config file along the lines of this file You can use letsencrypt to also generate a HTTPS version for that site.

= Helpful commands to check the state of the database =

Clean cache
run

Browse the data
Task retrieve the input given a key ... in this example we'll use 0f7fa7bb7d214c60f8d2f0b8d356c41bfe5c5d1d as key run  _domain      | key                                      | tid                                  | _del | content-location | content-sha256 | content-type     | headers                             |latestTid | tags | value ---+--+--+--+--++--+-+---+--+ wikimedia.org | 0f7fa7bb7d214c60f8d2f0b8d356c41bfe5c5d1d | e736aba4-9edc-11e5-927a-301f88a60cb9 | null |            null |           null | application/json | {"content-type":"application/json"} |      null | null | {"q":"=nf(x)\\left({n-1 \\choose k-1}F(x)^{k-1}(1-F(x))^{(n-1)-(k-1)}-\\underbrace {{n-1 \\choose n}F(x)^{n}(1-F(x))^{(n-1)-n}} \\right)","type":"inline-tex"}