Search for textbooks

POST /api/textbooks/searchtextbooks

Searches for textbooks based on the provided query. The search is performed on the title, author, and description fields. This endpoint requires JWT authentication. Sensitive information is removed from the response.

application/json

Body Required

  • textbook string Required

    The search query for textbooks

Responses

  • 200 application/json

    Successfully retrieved matching textbooks

    Hide response attribute Show response attribute object
    • textbooks array[object]
      Hide textbooks attributes Show textbooks attributes object
      • _id string
      • title string
      • author string
      • description string
  • 400 text/plain

    Bad request - textbook query is missing

  • 401 text/plain

    Unauthorized - No valid JWT token provided

  • 403 text/plain

    Forbidden - Invalid JWT token

  • 500 text/plain

    Internal server error

POST /api/textbooks/searchtextbooks
curl \
 --request POST 'http://localhost:xxxx/api/textbooks/searchtextbooks' \
 --cookie "jwt=$API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"textbook":"计算机科学"}'
Request examples
{
  "textbook": "计算机科学"
}
Response examples (200)
{
  "textbooks": [
    {
      "_id": "60d21b4667d0d8992e610c85",
      "title": "计算机科学导论",
      "author": "张三",
      "description": "这是一本关于计算机科学基础的全面指南"
    }
  ]
}
Response examples (400)
需要教科书来搜索
Response examples (401)
您未通过身份验证
Response examples (403)
无效的令牌
Response examples (500)
服务器内部错误