With Open Heritage Map, you can preserve memories about objects or locations that no longer exists. Add or edit information about these memories, like a story or a photograph, on the geographical map and cherish them forever as historical data!
This application is running under node.js, you will then need it in order to make it run properly, install node here. You can check that nodejs is installed by typing node --version
in a terminal.
If it is your first use of this little 'backend', you first have to use the command npm install
in the folder to install all the required packages to make this REST API work.
You can start the server by typing node server.js
There are actually two callable function for this REST API:
Fetch a loginToken from wikimedia commons API, logs in with credentials (You can add your own credentials in a bot.json file placed in the root folder) and fetch a CSRFToken used to, here, upload a picture to wikimedia commons
Uploads the image, make the returned url pass through the bitly API to make it shorter and then returns it to your frontend Actually the upload feature is unavailable, due to our testing, we have unfortunately been banned from wikimedia. If you use this backend to use the image feature, please make your own wikimedia account and then make your bot.json file with the template given below.
In order to log in wikimedia and bitly you need credentials: for obvious security reasons, the original bot.json
credentials file is not shared online. But you can create your own by registering an account at wikimedia and after create a bot password here
You also need an account for shortening links through bit.ly API. You can create an account here. Steps to get the API credentials below.
Here is a template of the bot.json
credentials file:
{
"loginInfo": {
"lgname": "<given wikimedia's bot login username>",
"lgpassword": "<given wikimedia's bot password>"
},
"wikimedia": {
"login": "<given bitly's login username>",
"api_key": "<given bitly's password>"
}
}
Just follow the red arrows after creating your account and being on the bitly page.
Go to your account settings
Click advanced settings
Click API Support
There are your credentials, you can copy/paste them into the bot.json file that you created based on the template given