Skip to content

benjamindpb/flask-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask API for Wikidata Atlas project

Requirements

The Python version must be greater than or equal to 3.9.

To install the additional requirements of the API, the following command must be executed in the terminal, located in the main folder of the API.

pip install -r requirements.txt

API execution

Once all the API requirements have been installed, it is possible to run it.

To do this, you must execute the following command in the terminal:

python app.py

With this, the default API will be hosted in localhost:5000 (http://127.0.0.1:5000)

Uses (API calls)

The API has the following endpoints to obtain information from the Wikidata database:

  • Getting instances of a georeferential type
localhost:5000/data/<search>/<limit>

Where search corresponds to the label of the type and limit to the number of instances to get.

  • Returns a dictionary with all georeferenceable types found after preprocessing the dump.
localhost:5000/types
  • Returns the information corresponding to a type, given its ID.
localhost:5000/type/<id>

Where id corresponds to the unique identifier of the entity (entity ID)

  • This endpoint is related to type search autocompletion. It is based on the percentage of georeferenceable instances of a given type to get all types whose label starts with the lookup that is entered as input.
localhost:5000/autocomplete/<search>

Where search corresponds to a string that symbolizes the desired search.


Alt text