API Reference¶
bear.api
¶
lifespan(app)
async
¶
Lifespan event handler for FastAPI to manage startup and shutdown tasks.
read_root()
¶
Root endpoint to provide instructions for using the API.
search_resource_route(query=Query(..., title='The query string to search for.'), top_k=Query(3, title='The number of results to return.'), resource_name=Query('work', title='The resource type to search (default: work).'), min_distance=Query(None, title='Minimum distance threshold for results.'), since_year=Query(None, title='Filter results from this year onwards.'))
¶
Search for resources based on the provided query and parameters.
Source code in bear/api.py
search_author_route(query=Query(..., title='The query string to search for authors.'), top_k=Query(3, title='The number of results to return.'), institutions=Query(None, title='Filter authors by institutions.'), min_distance=Query(None, title='Minimum distance threshold for results.'), since_year=Query(None, title='Filter results from this year onwards.'))
¶
Search for authors based on the provided query and parameters.
Source code in bear/api.py
Endpoints¶
The BEAR API provides RESTful endpoints for searching academic resources and authors.
Base URL¶
Authentication¶
Currently, no authentication is required for API access.
Response Format¶
All responses are in JSON format. Successful responses return the requested data, while errors return an error object with a message.
Error Handling¶
The API uses standard HTTP status codes:
200 OK
- Request successful404 Not Found
- No results found422 Unprocessable Entity
- Invalid request parameters500 Internal Server Error
- Server error
Models¶
ResourceSearchResult¶
Response model for resource search results.
AuthorSearchResult¶
Response model for author search results.