2019-02-14 00:38:30 +00:00
|
|
|
# River of Ebooks REST API
|
|
|
|
## Information on how to use the api endpoints to publish and view ebook metadata
|
|
|
|
|
2019-03-05 20:39:07 +00:00
|
|
|
### Publishing ebook metadata
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
```
|
2019-02-24 21:27:24 +00:00
|
|
|
POST to /api/publish containing headers:
|
|
|
|
{
|
|
|
|
roe-key: <api key>,
|
|
|
|
roe-secret: <api secret>
|
|
|
|
}
|
|
|
|
|
2019-03-14 16:58:22 +00:00
|
|
|
and opds2 publication body with type `application/json`:
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
{
|
2019-03-14 16:58:22 +00:00
|
|
|
"metadata": {
|
|
|
|
"@type": "http://schema.org/Book",
|
|
|
|
"title": "Moby-Dick",
|
|
|
|
"author": "Herman Melville",
|
|
|
|
"identifier": "urn:isbn:978031600000X",
|
2019-04-01 21:19:16 +00:00
|
|
|
"tags": "story,classic",
|
2019-03-14 16:58:22 +00:00
|
|
|
"publisher": "Ebook Publisher.com",
|
|
|
|
"language": "en",
|
|
|
|
"modified": "2015-09-29T17:00:00Z"
|
|
|
|
},
|
|
|
|
"links": [
|
|
|
|
{"rel": "self", "href": "http://example.org/manifest.json", "type": "application/webpub+json"}
|
|
|
|
],
|
|
|
|
"images": [
|
|
|
|
{"href": "http://example.org/cover.jpg", "type": "image/jpeg", "height": 1400, "width": 800},
|
|
|
|
{"href": "http://example.org/cover-small.jpg", "type": "image/jpeg", "height": 700, "width": 400},
|
|
|
|
{"href": "http://example.org/cover.svg", "type": "image/svg+xml"}
|
|
|
|
]
|
2019-02-14 00:38:30 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-03-14 16:58:22 +00:00
|
|
|
@Type must be `http://schema.org/Book`.
|
|
|
|
Each tuple of `(title, author, publisher, identifier, modified)` must be unique.
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
The server will respond with either:
|
|
|
|
|
|
|
|
```
|
|
|
|
200 OK
|
|
|
|
{
|
|
|
|
"created_at": 1550102480021,
|
|
|
|
"updated_at": 1550102480021,
|
|
|
|
"id": number,
|
|
|
|
"title": string,
|
|
|
|
"author": string,
|
2019-04-01 21:09:11 +00:00
|
|
|
"tags": array,
|
2019-03-14 16:58:22 +00:00
|
|
|
"publisher": string,
|
|
|
|
"identifier": string,
|
2019-03-05 20:39:07 +00:00
|
|
|
"version": string,
|
2019-03-14 16:58:22 +00:00
|
|
|
"opds": json
|
2019-02-14 00:38:30 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
```
|
2019-02-24 21:27:24 +00:00
|
|
|
400 BAD REQUEST / 403 UNAUTHORIZED
|
2019-02-14 00:38:30 +00:00
|
|
|
{
|
|
|
|
"error": string,
|
|
|
|
"hint": string
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Fetching published books
|
|
|
|
|
2019-03-05 20:39:07 +00:00
|
|
|
GET from /api/catalog/all with the query string parameters:
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
```
|
2019-03-05 20:39:07 +00:00
|
|
|
title: The ebook's title (optional)
|
2019-02-14 00:38:30 +00:00
|
|
|
author: The author (optional)
|
|
|
|
version: A version number (optional)
|
|
|
|
isbn: The ISBN (optional)
|
2019-04-01 21:09:11 +00:00
|
|
|
tags: Comma-separated search tags (optional)
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
page: The page of results to view (200 results per page)
|
|
|
|
```
|
|
|
|
|
2019-03-05 20:39:07 +00:00
|
|
|
For example: `GET /api/catalog/all?title=foo&page=3`
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
The server will respond with either:
|
|
|
|
|
|
|
|
```
|
|
|
|
200 OK
|
2019-03-05 20:39:07 +00:00
|
|
|
{
|
|
|
|
"metadata":{
|
|
|
|
"title": "RoE all publications",
|
|
|
|
"itemsPerPage": 200,
|
|
|
|
"currentPage": 1
|
|
|
|
},
|
|
|
|
"links":[
|
|
|
|
{
|
|
|
|
"rel": "self",
|
|
|
|
"href": "all?page=1",
|
|
|
|
"type": "application/opds+json"
|
|
|
|
}
|
|
|
|
{
|
|
|
|
"rel": "search",
|
|
|
|
"href": "all{?title,author,version,isbn}",
|
|
|
|
"type": "application/opds+json",
|
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"publications":[
|
|
|
|
{
|
|
|
|
"metadata":{
|
|
|
|
"@type": "http://schema.org/Book",
|
|
|
|
"title": "Moby-Dick",
|
|
|
|
"author": "Herman Melville",
|
2019-04-01 21:19:16 +00:00
|
|
|
"tags": "story,classic",
|
2019-03-14 16:58:22 +00:00
|
|
|
"publisher": "Ebook Publisher.com",
|
2019-03-05 20:39:07 +00:00
|
|
|
"identifier": "urn:isbn:978031600000X",
|
|
|
|
"language": "en",
|
|
|
|
"modified": "2015-09-29T17:00:00Z"
|
|
|
|
},
|
|
|
|
"links":[
|
|
|
|
{
|
|
|
|
"rel": "self",
|
|
|
|
"href": "http://example.org/manifest.json",
|
|
|
|
"type": "application/webpub+json"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"images":[
|
|
|
|
{
|
|
|
|
"href": "http://example.org/cover.jpg",
|
|
|
|
"type": "image/jpeg",
|
|
|
|
"height": 1400,
|
|
|
|
"width": 800
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"href": "http://example.org/cover.svg",
|
|
|
|
"type": "image/svg+xml"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-02-14 00:38:30 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
```
|
|
|
|
404 NOT FOUND
|
|
|
|
{
|
|
|
|
"error": string,
|
|
|
|
"hint": string
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Receiving push notifications to your webhooks:
|
|
|
|
|
|
|
|
- Log in to the River of Ebooks website
|
|
|
|
- Add your webhook URL and desired filters
|
|
|
|
|
2019-03-05 20:39:07 +00:00
|
|
|
The server will send a POST request with the following body to the provided URL whenever a new ebook is published through the pipeline:
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
HTTP Headers:
|
2019-02-14 00:41:42 +00:00
|
|
|
User-Agent: RoE-aggregator
|
2019-03-06 00:56:55 +00:00
|
|
|
X-Roe-Request-Timestamp: number
|
|
|
|
X-Roe-Signature: string
|
2019-02-14 00:38:30 +00:00
|
|
|
|
|
|
|
HTTP Body:
|
|
|
|
{
|
2019-03-05 20:39:07 +00:00
|
|
|
"metadata":{
|
|
|
|
"@type": "http://schema.org/Book",
|
|
|
|
"title": "Moby-Dick",
|
|
|
|
"author": "Herman Melville",
|
2019-04-01 21:19:16 +00:00
|
|
|
"tags": "story,classic",
|
2019-03-14 16:58:22 +00:00
|
|
|
"publisher": "Ebook Publisher.com",
|
2019-03-05 20:39:07 +00:00
|
|
|
"identifier": "urn:isbn:978031600000X",
|
|
|
|
"language": "en",
|
|
|
|
"modified": "2015-09-29T17:00:00Z"
|
|
|
|
},
|
|
|
|
"links":[
|
|
|
|
{
|
|
|
|
"rel": "self",
|
|
|
|
"href": "http://example.org/manifest.json",
|
|
|
|
"type": "application/webpub+json"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"images":[
|
|
|
|
{
|
|
|
|
"href": "http://example.org/cover.jpg",
|
|
|
|
"type": "image/jpeg",
|
|
|
|
"height": 1400,
|
|
|
|
"width": 800
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"href": "http://example.org/cover.svg",
|
|
|
|
"type": "image/svg+xml"
|
|
|
|
}
|
|
|
|
]
|
2019-02-14 00:38:30 +00:00
|
|
|
}
|
|
|
|
```
|