Using the API

The MEHDIE API gives read-only access to the public datasets on this site: their metadata, the places (or people) they contain, and searches over those records by name or location. No sign-in or key is needed. Suggestions are welcome through .

Identifiers

Each dataset has a numeric id and a short, unique label (e.g. KIMA-IL). Every record has a MEHDIE place_id, unique across the site, and keeps the src_id it had in its source dataset. Both stay stable as long as the dataset is on the site. The record URI is https://tools.mehdie.org/api/place/<place_id>/.

People datasets (e.g. DiJeSt People) are stored like place datasets; their records are served by the same endpoints. A dataset's datatype says which it is.

Responses

All responses are JSON. Place searches return a GeoJSON FeatureCollection in the Linked Places format, with every name variant of a record (in all its languages and scripts), its types, links, dates and geometry.

An invalid request gets status 400 and a record or dataset that does not exist (or is not public) gets 404, each with a JSON message, e.g. {"detail": "Parameter 'lat' must be a number, got 'abc'."}

Linked data

The same data, with the links MEHDIE found between records, is also available as RDF from the knowledge graph: see the SPARQL examples.

Endpoints

/api/datasets/ lists the public datasets with their metadata and record counts.

parametervaluenotes
<none>n/aall public datasets
qstringtext in the dataset title or description
datatypestringplace or people
labelstringa single dataset by label
idintegera single dataset by id

/api/datasets/<label>/ returns the metadata of one dataset.

/api/datasets/<label>/places/ lists every record in the dataset: its id, src_id and title, ordered by id. Fetch a full record with /api/place/<id>/.

Examples

All public datasets

/api/datasets/

Datasets from Kima, the historical Hebrew-script place-name database

/api/datasets/?q=kima

Datasets of people rather than places

/api/datasets/?datatype=people

Metadata of the DiJeSt places dataset

/api/datasets/DiJeSt-DB/

Ids of all records in KIMA-IL

/api/datasets/KIMA-IL/places/

/api/place/<place_id>/ returns one full record, by its MEHDIE place_id.

/api/place/<label>/<src_id>/ returns the same record by the dataset label and the record's id in its source.

Besides names, types, links, dates and geometry, a record includes a small graph (nodes, edges) of the records it is linked to: matches in other MEHDIE datasets, external authorities such as Wikidata, and related places such as the region it lies in.

Examples

Jerusalem in the Himme dataset, by place_id

/api/place/44942/

The same record by dataset label and src_id

/api/place/himme/280/

/api/spatial/ finds records with point geometry near a location (nearby, nearest first) or inside a bounding box (bbox). Records without coordinates are not included. Returns a FeatureCollection.

parametervaluenotes
type✳stringnearby or bbox
lon‡decimal deg.longitude (WGS84)
lat‡decimal deg.latitude (WGS84)
km‡numbersearch radius in km
sw†lon,latsouthwest corner of the box
ne†lon,latnortheast corner of the box
datasetstringdataset label
fcstring1 or more GeoNames feature class letters, e.g. P,S
pagesizeintegerdefault 20, maximum 200

✳ always required;  ‡ required for nearby;  † required for bbox

Examples

Records within 5 km of Jerusalem's Old City, nearest first

/api/spatial/?type=nearby&lon=35.2167&lat=31.7833&km=5

The same, KIMA-IL records within 10 km

/api/spatial/?type=nearby&lon=35.2167&lat=31.7833&km=10&dataset=KIMA-IL

Records in a box around Jerusalem

/api/spatial/?type=bbox&sw=35.15,31.74&ne=35.26,31.81