This project was started at the PLOS article level metrics hackathon on 2014-12-06. The hackathon repo: https://github.com/articlemetrics/hackathon_2014
This repo contains a Ruby Sinatra API for serving versions of articles, based on a article DOI, or a query. Data is stored in, and search provided by, Elasticsearch.
git clone git@github.com:sckott/mapurisapi.git
cd mapurisapi
bundle install
curl -L -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.1.tar.gz
untar elasticsearch-1.4.1.tar.gz
sudo mv /path/to/elasticsearch-1.4.1 /usr/local
(replace version with your version)cd /usr/local
sudo ln -s elasticsearch-1.4.1 elasticsearch
(replace version with your verioon)You can also install via Homebrew: brew install elasticsearch
Install elasticdump
tool
sudo npm install elasticdump -g
Push data into ES via the bulk endpoint
cd mapurisapi
elasticdump --bulk=true --input=data.json --output=http://localhost:9200/
Then ping ES to make sure it's there
curl localhost:9200/mapuris
cd mapurisapi
ruby api.rb
curl http://localhost::4567/heartbeat
{
status: "ok"
}
The root redirects to /heartbeat
(/heartbeat
gives the same thing)
curl -L http://localhost:4567
{
"status": "ok",
"paths": [
"/heartbeat",
"/links/:doi",
"/search"
]
}
curl http://localhost:4567/links/10.12688/f1000research.3817.1
{
status: "ok",
data: {
_id: "10.12688/f1000research.3817.1",
_rev: "1-16b4fe65ddc6be789c76761a8e7fb810",
doi: "10.12688/f1000research.3817.1",
url: "http://dx.doi.org/10.12688/f1000research.3817.1",
pdf: "http://f1000research.com/articles/3817/1/pdf",
xml: "http://f1000research.com/articles/3817/1/xml",
cm_target_doi: { },
cm_assertions: [
"http://f1000research.com/articles/3-80/v1#article-reports",
"http://f1000research.com/articles/3-80/v1#referee-response-4304",
"http://f1000research.com/articles/3-80/v1#referee-response-5889"
],
figs: "f1000research-3-4089-g0000.gif",
media: { }
}
}