Skip to content

Provide access from UI to the Mediawiki APIs and some other APIs

License

Notifications You must be signed in to change notification settings

Wikidocumentaries/wikidocumentaries-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 27, 2023
684ddde · Jun 27, 2023
Feb 16, 2023
Apr 9, 2019
Jul 19, 2018
Jul 19, 2018
Jul 19, 2018
Feb 20, 2023
Nov 4, 2021
Dec 22, 2019
Jun 7, 2019
Dec 13, 2021
Dec 13, 2021
Nov 24, 2021
Jun 7, 2019
Jun 27, 2023
Feb 20, 2023
Feb 20, 2023
May 21, 2023
Dec 13, 2021
Nov 24, 2021
Nov 24, 2021
Jun 7, 2019
May 21, 2023
Dec 15, 2019
Feb 14, 2023
Dec 15, 2019

Repository files navigation

wikidocumentaries-api

Provides REST APIs and a backend service for the Wikidocumentaries UI for the following purposes:

  • Fetch data from both Wikipedia and Wikidata when given an id from either.

  • Search for images from various sources with one request.

  • Find related data from Wikidata and other wikibases using SPARQL queries.

  • Set a custom User-Agent header as required by Mediawiki APIs.

  • Work around Wikidata Query Service (WDQS) not providing an Access-Control-Allow-Origin header.

  • etc.

Also see the section Provided endpoints below.

Docker

You can run this service as a container with

docker run -p 3000:3000 -e WIKIDOCUMENTARIES_API_USER_AGENT -e BING_MAPS_KEY -e FLICKR_KEY wikidocumentaries/wikidocumentaries-api

You can build a new version of the container image with

docker build -t wikidocumentaries/wikidocumentaries-api .

Install

npm install

Run in development mode

npm run dev

Run in production mode

npm start

Environment variables

Some API keys should be set as environment variables:

Provided endpoints

The main API endpoints:

  • /wiki

    • Parameters (provide either wikidata or topic):
      • language: language code
      • wikidata: id of the Wikidata item
      • topic: title of the Wikipedia article
    • Response:
      • wikidata
        • id
        • title
        • description
        • aliases
        • instance_of
        • statements
        • geo
        • dates
        • sitelinks
      • wikipedia
        • type
        • title
        • displaytitle
        • namespace
        • wikibase_item
        • titles
        • pageid
        • thumbnail
        • originalimage
        • lang
        • dir
        • revision
        • tid
        • timestamp
        • description
        • description_source
        • coordinates
        • content_urls
        • extract
        • extract_html
      • wikipediaExcerptHTML
      • wikipediaRemainingHTML
  • /images

    • Parameters:
      • language: language code
      • topic: search string
      • commons_category: if provided, return everything from this category in Wikimedia Commons; without the prefix "Category:"
      • lat, lon: coordinates to search around
      • maxradius: radius around the coordinates
    • Response:
      • a list of images:
        • source
        • id
        • title
        • imageURL
        • thumbURL
        • infoURL
        • license
        • license_link
        • inventoryNumber
        • geoLocations
        • location
        • measurements
        • materials
        • formats
        • year
        • publisher
        • creators
        • institutions
        • actors
        • details
        • subjects
        • places
        • collection
        • imageRights
        • description
        • inscriptions
        • datecreated
        • uploader
        • collection
        • language
  • /sparql

    • Parameters (following the standard for SPARQL queries):
      • query
      • format
    • Response depending on format

About

Provide access from UI to the Mediawiki APIs and some other APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published