Help:Contributing/api
Jump to navigation
Jump to search
The full Wikibase API is available at https://wikibase.ronzz.org/api.php. It requires login and a CSRF token. This page is for editors who want to script or bulk-edit; for interactive editing, see Help:Contributing/entities.
Log in and get a CSRF token (adjust the credentials):
# 1) Log in
curl -s -c /tmp/wb.cookies "https://wikibase.ronzz.org/api.php" \
--data-urlencode "action=query" --data-urlencode "meta=tokens" \
--data-urlencode "type=login" --data-urlencode "format=json"
# …POST action=login with lgname/lgpassword/lgtoken, then:
TOKEN=$(curl -s -b /tmp/wb.cookies "https://wikibase.ronzz.org/api.php?action=query&meta=tokens&format=json" \
| python3 -c "import json,sys; print(json.load(sys.stdin)['query']['tokens']['csrftoken'])")
# 2) Create an item (wbeditentity)
curl -s -b /tmp/wb.cookies "https://wikibase.ronzz.org/api.php" \
--data-urlencode "action=wbeditentity" --data-urlencode "new=item" \
--data-urlencode "token=$TOKEN" \
--data-urlencode 'data={"labels":{"en":{"language":"en","value":"My first item"}}}' \
--data-urlencode "format=json"
Key API actions: wbeditentity (create/update), wbgetentities (read), wbcreateclaim/wbsetclaim (statements), wbsearchentities (find by label), wbremoveclaims. A REST API is also available under /w/rest.php/wikibase/.
Bulk tools
These tools are not installed on the instance — run them from your own machine:
- WikibaseIntegrator (Python)
- Pywikibot (official manual)
- QuickStatements (spreadsheet-style batch)
See also
- Help:Contributing — the hub
- Wikibase documentation (official)
- action=wb… API reference (Wikidata)