-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/pku-software/pku-software.g…
- Loading branch information
Showing
3 changed files
with
79 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# API 详细文档 | ||
|
||
API 部署网址:`http://docman.lcpu.dev` | ||
|
||
## 获取网页标题 | ||
|
||
- API地址: `/title/{URL}` | ||
- 请求方法: `GET` | ||
- 参数: | ||
- URL (string) - URL-encoded 的网页地址 | ||
- 响应: | ||
- 200 OK: Successfully retrieved the title. | ||
```json | ||
{ | ||
"title": "Example Title" | ||
} | ||
``` | ||
- 400 Bad Request: Invalid URL format. | ||
- 500 Internal Server Error: An internal error occurred. | ||
- 例子: | ||
- 获取`www.pytorch.org`的标题 | ||
```c++ | ||
auto url = "www.pytorch.org"; | ||
auto result = cli.Get("/title/" + encodeUriComponent(url)); | ||
std::cout << result->body << std::endl; | ||
``` | ||
|
||
## 通过 ISBN 获取书籍信息 | ||
|
||
- API地址: `/isbn/{ISBN}` | ||
- 请求方法: `GET` | ||
- 参数: | ||
- ISBN (string) - URL-encoded ISBN | ||
- 响应: | ||
- 200 OK: Successfully retrieved book information. | ||
```json | ||
{ | ||
"author": "Author One, Author Two", | ||
"title": "Book Title", | ||
"publisher": "Publisher Name", | ||
"year": "Year of Publication" | ||
} | ||
``` | ||
- 400 Bad Request: Invalid ISBN format. | ||
- 500 Internal Server Error: An internal error occurred. | ||
- 例子: | ||
- 获取`9780134092669`的书籍信息: | ||
```c++ | ||
auto isbn = "9780134092669"; | ||
auto result = cli.Get("/isbn/" + encodeUriComponent(isbn)); | ||
std::cout << result->body << std::endl; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters