adsabs / adsabs-dev-api

Developer API service description and example client code
163 stars 58 forks source link

Is an integrated `read_count` available? #12

Closed barentsen closed 9 years ago

barentsen commented 9 years ago

I understand from #11 that the read_count field is a "90-day count of views and downloads from ads and arxiv".

Is there also a field that gives the total read count integrated over the entire life of the article, or could such a field be made available?

jonnybazookatone commented 9 years ago

One way is to use the metrics end point. You can do this directly with curl:

curl -XPOST 'https://api.adsabs.harvard.edu/v1/metrics' -H 'Authorization: Bearer:<API_TOKEN>' -H 'Content-Type: application/json' -d '{"bibcodes": [<BIBCODE>]}' | python -m json.tool | grep "total number of reads" | head -1
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
> 100  3020  100  2983  100    37   6817     84 --:--:-- --:--:-- --:--:--  6826
        "total number of reads": 14

or using the API client.

import ads
papers = list(ads.SearchQuery(q="bibcode:\"2015arXiv150701293E\""))[0]
print papers.metrics['basic stats']['total number of reads']
>>> 14
aaccomazzi commented 9 years ago

One thing to keep in mind is that the historical reads returned by the metrics service contains only usage data from ADS logs (with robots and applications filtered out), so it does not include the arXiv usage.

barentsen commented 9 years ago

Ok, thanks for the info!