The YaMDb API allows you to interact with the RESTful API of a fictional YaMDb review service for creative works like movies, books, and music.
- Getting a list of all reviews for a title
- Getting a review or comment by ID
- Getting a list of comments to a review
- CRUD for reviews and comments
- Fork and clone the repository
- Set up a virtual environment
- Install the dependencies:
pip install -r requirements.txt
- Configure email settings in
settings.py
To get access to the API, make a POST request with your email address to /api/v1/auth/email
, after which you will receive a confirmation code. Next, submit a POST request to /api/v1/auth/token
with your email address and the confirmation token. In response, you'll receive a JWT token. When calling the API, pass the token in the header as Authorization: Bearer [token].
Sample POST request to /api/v1/titles/{title_id}/reviews/
:
{
"text": "Friends is the best sitcom ever!",
"score": 10
}
Sample response:
{
"id": 0,
"text": "Friends is the best sitcom ever!",
"author": "sergeyrodin",
"score": 10,
"pub_date": "2021-04-05T14:15:22Z"
}
Sample POST request to /api/v1/titles/{title_id}/reviews/{review_id}/comments/
to add a comment to a review:
{
"text": "I'd argue that HIMYM is better.",
}
Sample response:
{
"id": 0,
"text": "I'd argue that HIMYM is better.",
"author": "andrewzhang",
"pub_date": "2021-04-06T14:15:22Z"
}
See the complete API specification (redoc.yaml).
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.