Difference between revisions of "Mediawiki API"
Line 9: | Line 9: | ||
This scenario is to acommodate automation process on behalf of specified user. To enable the process, you will need to prepare your bot account, which can be done by visiting [Special:BotPasswords], then you decide the bot name and Mediawiki will prepare the username and password that can be use to access the API. Please see the right image for reference. | This scenario is to acommodate automation process on behalf of specified user. To enable the process, you will need to prepare your bot account, which can be done by visiting [Special:BotPasswords], then you decide the bot name and Mediawiki will prepare the username and password that can be use to access the API. Please see the right image for reference. | ||
[[File:Bot-password.jpg|thumb|center|Bot Password setup on Mediawiki]] | [[File:Bot-password.jpg|thumb|center|Bot Password setup on Mediawiki]] | ||
First API to call | |||
Type: GET | |||
{| class="wikitable" style="vertical-align:bottom;" | |||
|- style="font-weight:bold;" | |||
! key | |||
! value | |||
|- | |||
| action | |||
| query | |||
|- | |||
| meta | |||
| tokens | |||
|- | |||
| format | |||
| json | |||
|- | |||
| type | |||
| login | |||
|} | |||
Response: | |||
<pre> | |||
{ | |||
"batchcomplete": "", | |||
"query": { | |||
"tokens": { | |||
"logintoken": "ed965e6288be0ab007b8eab63637cca762eb3af1+\\" | |||
} | |||
} | |||
} | |||
</pre> | |||
===2. Using Your Account=== | ===2. Using Your Account=== |
Revision as of 03:21, 4 August 2022
Introduction to Mediawiki API
API stands for Application Programmer Interface, is one way of communicating through a system using a standard way of communication between applications. API Services of this mediawiki can be found in | API Documentation.
Process Flow
This process flow is to documenting on how the front-end application can communicate with instance of Mediawiki, in this context is PKC.
Login Process
Mediawiki API have two different scenarios for handling login process.
1. Using Robot Account
This scenario is to acommodate automation process on behalf of specified user. To enable the process, you will need to prepare your bot account, which can be done by visiting [Special:BotPasswords], then you decide the bot name and Mediawiki will prepare the username and password that can be use to access the API. Please see the right image for reference.
First API to call Type: GET
key | value |
---|---|
action | query |
meta | tokens |
format | json |
type | login |
Response:
{ "batchcomplete": "", "query": { "tokens": { "logintoken": "ed965e6288be0ab007b8eab63637cca762eb3af1+\\" } } }
2. Using Your Account
This scenario is to acommodate fully interactive process to Mediawiki, and positioning Mediawiki as the backend.