User:Ola Efimova/Sandbox/API:Checktoken
This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.25 |
API documentation[edit]
Checks the validity of a token from the tokens module.
Module "tokens" not found.
|
Example[edit]
GET request[edit]
Description of script
api.php? action=checktoken& type=csrf& token=68195b6a939549c577bd6662dbe5003a563d3b2c+\ [try in ApiSandbox]
Response[edit]
{
"warnings": {
"checktoken": {
"*": "Check that symbols such as \"+\" in the token are properly percent-encoded in the URL."
}
},
"checktoken": {
"result": "invalid"
}
}
Sample code[edit]
Python[edit]
#!/usr/bin/python3
"""
hello.py
MediaWiki Action API Code Samples
Demo of `...` module
MIT license
"""
PHP[edit]
<?php
/*
hello.php
MediaWiki API Demos
Demo of `...` module
MIT License
*/
a:2:{s:8:"warnings";a:1:
{s:10:"checktoken";a:1:
{s:1:"*";s:84:"Check that symbols such as "+" in the token are properly percent-encoded in the URL.";}}
s:10:"checktoken";a:1:
{s:6:"result";s:7:"invalid";}}
Javascript[edit]
/*
hello.js
MediaWiki API Demos
Demo of `...` module
MIT License
*/
MediaWiki JS[edit]
/*
hello.js
MediaWiki API Demos
Demo of `...` module
MIT License
*/
Demo app(s)[edit]
- Check the validity of a token from action=query&meta=tokens.
Additional notes[edit]
- This module cannot be used as a Generator.
See also[edit]
- Check a CSRF token.