Example 1: Wikipedia
Last updated on
31 January 2024
Wikipedia API
We will use the API Endpoint https://en.wikipedia.org/w/api.php which is documented at https://www.mediawiki.org/wiki/API:Main_page.
Create entity type
- go to admin/structure/external-entity-types/add
- name: 'Wikipage'
- name (plural): 'Wikipedia pages'
- on tab 'Field mapping' select Field mapper 'Simple'
Define storage client
- Storage client: choose 'Wiki'
- endpoint
https://en.wikipedia.org/w/api.php - response format choose 'json'
- pager settings (no effect as this is overridden by code): 'page', page number, 'pagesize'. number of items per page
- list parameters:
action|query list|categorymembers cmtitle|Category:Haarlem cmlimit|20 format|jsonNote that the list is currently hardcoded based on pages in a category, you can place the category in cmtitle
- single parameters
action|query format|json prop|extracts
Fields mapping
- map fields (id and title):
id: pageid title: title - Save external entity
- Create a body text field
- map fields (add body field):
body > text: extract body > text format: +full_html - Save external entity
Verify entities
- Check the list of external entities on /wikipage

- Check an individual external entity, for example /wikipage/63278

Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion