Skip to content

mw wiki api

Releasev0.35.0 · cfeceb67

mw wiki api ACTION [flags]

Call an Action API module using the selected wiki and saved login. Requests default to GET, even with fields. Use –method POST for form-encoded writes. API errors return a failing exit status. Each call returns one response; pass continuation parameters explicitly for additional pages. Discovery is optional; refresh public parameter metadata with api refresh for offline completions.

-f, --field <stringArray>
API parameter as name=value (repeatable)
--format <string>
Format the specified output
-X, --method <string>
HTTP method: GET or POST Default: GET.
-o, --output <string>
Output format (jq|json) Default: json.
--raw
Print response bytes unchanged
--timeout <duration>
Total request timeout, including login Default: 30s.
--token <string>
Fetch and attach a token (csrf; POST only)
--anon
Use anonymous access instead of saved credentials
--help
Help for this command
--no-interaction
Do not ask any interactive questions
--password <string>
Wiki login password (or bot password)
--password-file <string>
Read the login password from a file
--profile <string>
Saved profile name or REALM/NAME
--realm <string>
Shared-login realm (wikimedia and wikibase-world are built in)
--username <string>
Wiki login username (use Name@bot for a bot password)
-v, --verbose <count>
Increase output verbosity. Example: --verbose=2 or -vv
--wiki <string>
Wiki URL or API endpoint
Terminal window
mw wiki api query -f titles=Earth -f prop=info
mw wiki api wbgetentities -f ids=Q42 --wiki www.wikidata.org
mw wiki api edit --method POST --token csrf -f title=Sandbox -f text=Example -f summary=Test
Report an issue with this page

Report a documentation issue

The report includes this page’s link, section and documentation version.

Review and submit on Phabricator, or run the command using your saved CLI profile. The command asks before creating the task.