mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-11-22 22:35:06 +01:00
Compare commits
No commits in common. "40045159671898a185dc7c2c0807731c539fbbaf" and "be83514de1a53ef872b8ea4ebd60fe8f40643ef6" have entirely different histories.
4004515967
...
be83514de1
@ -14,21 +14,8 @@ class RootResource:
|
|||||||
def on_get(self, req, resp):
|
def on_get(self, req, resp):
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
resp.content_type = "text/html"
|
resp.content_type = "text/html"
|
||||||
docs_html = (
|
with open("dspace_statistics_api/docs/index.html", "r") as f:
|
||||||
"<!DOCTYPE html>"
|
resp.body = f.read()
|
||||||
"<html lang=\"en-US\">"
|
|
||||||
" <head>"
|
|
||||||
" <meta charset=\"UTF-8\">"
|
|
||||||
" <title>DSpace Statistics API</title>"
|
|
||||||
" </head>"
|
|
||||||
" <body>"
|
|
||||||
f" <h1>DSpace Statistics API {VERSION}</h1>"
|
|
||||||
f" <p>This site is running the <a href=\"https://github.com/ilri/dspace-statistics-api\" title=\"DSpace Statistics API project\">DSpace Statistics API</a>. For more information see the project's README.md or the interactive <a href=\"{DSPACE_STATISTICS_API_URL + '/swagger'}\">Swagger UI</a> built into this API.</p>"
|
|
||||||
" </body>"
|
|
||||||
"</html"
|
|
||||||
)
|
|
||||||
|
|
||||||
resp.body = docs_html
|
|
||||||
|
|
||||||
|
|
||||||
class StatusResource:
|
class StatusResource:
|
||||||
|
44
dspace_statistics_api/docs/index.html
Normal file
44
dspace_statistics_api/docs/index.html
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>DSpace Statistics API</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>DSpace Statistics API v1.4.0-dev</h1>
|
||||||
|
<p>This site is running the <a href="https://github.com/ilri/dspace-statistics-api" title="DSpace Statistics API project">DSpace Statistics API</a>. The following endpoints are available:</p>
|
||||||
|
<ul>
|
||||||
|
<li>GET <code>/</code> — return a basic API documentation page.</li>
|
||||||
|
<li>GET <code>/items</code> — return views and downloads for all items that Solr knows about¹. Accepts <code>limit</code> and <code>page</code> query parameters for pagination of results (<code>limit</code> must be an integer between 1 and 100, and <code>page</code> must be an integer greater than or equal to 0).</li>
|
||||||
|
<li>POST <code>/items</code> — return views and downloads for an arbitrary list of items with an optional date range. Accepts <code>limit</code>, <code>page</code>, <code>dateFrom</code>, and <code>dateTo</code> parameters².</li>
|
||||||
|
<li>GET <code>/item/id</code> — return views and downloads for a single item (<code>id</code> must be a UUID). Returns HTTP 404 if an item id is not found.</li>
|
||||||
|
<li>GET <code>/communities</code> — return views and downloads for all communities that Solr knows about¹. Accepts <code>limit</code> and <code>page</code> query parameters for pagination of results (<code>limit</code> must be an integer between 1 and 100, and <code>page</code> must be an integer greater than or equal to 0).
|
||||||
|
<li>POST <code>/communities</code> — return views and downloads for an arbitrary list of communities with an optional date range. Accepts <code>limit</code>, <code>page</code>, <code>dateFrom</code>, and <code>dateTo</code> parameters².
|
||||||
|
<li>GET <code>/community/id</code> — return views and downloads for a single community (<code>id</code> must be a UUID). Returns HTTP 404 if a community id is not found.
|
||||||
|
<li>GET <code>/collections</code> — return views and downloads for all collections that Solr knows about¹. Accepts <code>limit</code> and <code>page</code> query parameters for pagination of results (<code>limit</code> must be an integer between 1 and 100, and <code>page</code> must be an integer greater than or equal to 0).
|
||||||
|
<li>POST <code>/collections</code> — return views and downloads for an arbitrary list of collections with an optional date range. Accepts <code>limit</code>, <code>page</code>, <code>dateFrom</code>, and <code>dateTo</code> parameters².
|
||||||
|
<li>GET <code>/collection/id</code> — return views and downloads for a single collection (<code>id</code> must be a UUID). Returns HTTP 404 if an collection id is not found.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>The id is the <em>internal</em> UUID for an item, community, or collection. You can get these from the standard DSpace REST API.</p>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<p>¹ We are querying the Solr statistics core, which technically only knows about items, communities, or collections that have either views or downloads. If an item, community, or collection is not present here you can assume it has zero views and zero downloads, but not necessarily that it does not exist in the repository.</p>
|
||||||
|
|
||||||
|
<p>² POST requests to <code>/items</code>, <code>/communities</code>, and <code>/collections</code> should be in JSON format with the following parameters (substitute the "items" list for communities or collections accordingly):</p>
|
||||||
|
<pre><code>{
|
||||||
|
"limit": 100, // optional, integer between 1 and 100, default 100
|
||||||
|
"page": 0, // optional, integer greater than 0, default 0
|
||||||
|
"dateFrom": "2020-01-01T00:00:00Z", // optional, default *
|
||||||
|
"dateTo": "2020-09-09T00:00:00Z", // optional, default *
|
||||||
|
"items": [
|
||||||
|
"f44cf173-2344-4eb2-8f00-ee55df32c76f",
|
||||||
|
"2324aa41-e9de-4a2b-bc36-16241464683e",
|
||||||
|
"8542f9da-9ce1-4614-abf4-f2e3fdb4b305",
|
||||||
|
"0fe573e7-042a-4240-a4d9-753b61233908"
|
||||||
|
]
|
||||||
|
}</code></pre>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,7 +1,7 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "dspace-statistics-api"
|
name = "dspace-statistics-api"
|
||||||
version = "1.4.0-dev"
|
version = "1.4.0-dev"
|
||||||
description = "A simple REST API to expose Solr view and download statistics for items, communities, and collections in a DSpace repository."
|
description = "A simple REST API to expose Solr view and download statistics for items in a DSpace repository."
|
||||||
authors = ["Alan Orth <aorth@mjanja.ch>"]
|
authors = ["Alan Orth <aorth@mjanja.ch>"]
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user