diff --git a/dspace_statistics_api/app.py b/dspace_statistics_api/app.py index 00722f5..c7e74ad 100644 --- a/dspace_statistics_api/app.py +++ b/dspace_statistics_api/app.py @@ -14,8 +14,21 @@ class RootResource: def on_get(self, req, resp): resp.status = falcon.HTTP_200 resp.content_type = "text/html" - with open("dspace_statistics_api/docs/index.html", "r") as f: - resp.body = f.read() + docs_html = ( + "" + "" + "
" + " " + "This site is running the DSpace Statistics API. For more information see the project's README.md or the interactive Swagger UI built into this API.
" + " " + " - - - -This site is running the DSpace Statistics API. The following endpoints are available:
-/
— return a basic API documentation page./items
— return views and downloads for all items that Solr knows about¹. Accepts limit
and page
query parameters for pagination of results (limit
must be an integer between 1 and 100, and page
must be an integer greater than or equal to 0)./items
— return views and downloads for an arbitrary list of items with an optional date range. Accepts limit
, page
, dateFrom
, and dateTo
parameters²./item/id
— return views and downloads for a single item (id
must be a UUID). Returns HTTP 404 if an item id is not found./communities
— return views and downloads for all communities that Solr knows about¹. Accepts limit
and page
query parameters for pagination of results (limit
must be an integer between 1 and 100, and page
must be an integer greater than or equal to 0).
- /communities
— return views and downloads for an arbitrary list of communities with an optional date range. Accepts limit
, page
, dateFrom
, and dateTo
parameters².
- /community/id
— return views and downloads for a single community (id
must be a UUID). Returns HTTP 404 if a community id is not found.
- /collections
— return views and downloads for all collections that Solr knows about¹. Accepts limit
and page
query parameters for pagination of results (limit
must be an integer between 1 and 100, and page
must be an integer greater than or equal to 0).
- /collections
— return views and downloads for an arbitrary list of collections with an optional date range. Accepts limit
, page
, dateFrom
, and dateTo
parameters².
- /collection/id
— return views and downloads for a single collection (id
must be a UUID). Returns HTTP 404 if an collection id is not found.
- The id is the internal UUID for an item, community, or collection. You can get these from the standard DSpace REST API.
- -¹ 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.
- -² POST requests to /items
, /communities
, and /collections
should be in JSON format with the following parameters (substitute the "items" list for communities or collections accordingly):
{
- "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"
- ]
-}
-
-
-