doubanbookapi
Just as the name, the API implemention for "Douban Book".
You can query book information via api which provided by Douban.com
and save it to local MongoDB.
Now a days, we finished the feature search engine supported via ElasticSearch.
Version
Content
- Requirements
- Installation
- Settings
Requirements
- Internet connection
- MongoDB v4.0.1 (Single-node or Cluster)
- [Optional] ElasticSearch v6.4.2 (with IK plugin)
Installation
- Make sure you have MongoDB installed and own the administrator role.
- Create one database which named by "smartlibrarian".
- Restore the Mongo(Structure & Data) by the json format script below.
$PRJ_ROOT/install/mongodb/smartlibrarian.sl_book_new.json
- Restore the ElasticSearch Index & Type mapping.
$PRJ_ROOT/install/elasticsearch/sl_book_new.book.txt
Settings
Site Settings
Website listening on:
Addr: 0.0.0.0
Port: 8080
If you want to change, just modify the file below:
<PRJ_ROOT>/configs/AppConfig.go
DB Settings
You can change MongoDB service here:
<PRJ_ROOT>/configs/MongoDBConfig.go
ES Settings
You can change ElasticSearch service here:
<PRJ_ROOT>/configs/EsConfig.go
How to use
Query API
Query Mongo directly and no search engine accelerate.
You can query book by Isbn, Author and even by Douban book Identifier(id).
Examples here:
-
by isbn
curl -XGET http://localhost:8080/v1/book/9787556820825
-
by ahthor
curl -XGET http://localhost:8080/v1/book/author/斯坦尼斯
-
by douban id
curl -XGET http://localhost:8080/v1/book/id/26952828
CIP API
Douban book API could not provide CIP information.
But we can fetch books' CIP information from opac.calis.edu.cn
P.S. Special Thanks to CALIS.
ISBN API
Search API
Data accelerated by ElasticSearch.