Closed SteelWagstaff closed 4 years ago
First design draft of the 'Book fetcher' service (Proposal):
All research is documented here: https://docs.google.com/document/d/1XUNw6CnT4X09yT2YwNMkqxiC08e82j7C3mHo5LLMGRI/
This an example of the transformed data that we will be sending to Algolia:
{
"name": "The onboarding process",
"inLanguage": "en",
"author": "admin",
"image": "https://pressbooks.test/app/plugins/pressbooks/assets/dist/images/default-book-cover.jpg",
"license": "All Rights Reserved",
"_links": {
"self": [
{
"href": "https://pressbooks.test/theonboarding/wp-json/pressbooks/v2/metadata"
}
]
}
}
Use the existing Pressbooks API to fetch and store book info for multiple hosted PressbooksEDU networks in our Algolia test account.
Our API documentation: https://docs.pressbooks.org/rest-api/ The WIP spec for the directory w/ description of current data elements in V2 of Book API: https://docs.google.com/document/d/1DIHAuew1nyGErLExtHfj2rNcInvVX_scJ2DHJwzORns/edit#
Foundation checklist:
[x] Find books API endpoint
[x] Does the following URL works locally?
https://pressbooks.test/wp-json/pressbooks/v2/books
, we need to enable the WP API to work locally.[x] Investigate how to obtain a response larger that 10 books. (Check the WP REST API supported parameters and understand the book query) Answer: We can pass query parameter
per_page
[x] Investigate how to support incremental REST API queries. Check if the API can handle queries that support 'post_modified' date ranges. Answer: The last modified depends on the book and the criteria to filter by. One option is to get the list of books and for each book, filter it by the last modified chapter using parameter ‘after’ with ISO8601 compliant date.
https://press.rebus.community/newbook/wp-json/pressbooks/v2/chapters?after=2016-01-01T00:00:00
To @ho-man-chan's knowledge, you currently cannot filter directly by last modified on a book, but only on the data within. We have to decide the data that is worthy of an update to Algolia. Or we can update on all data that was last modified.[x] Investigate if the WP PB REST API returns only public books. Answer: By default, only public books are returned.
TO DO: