DJANGO REST FRAMEWORK API
-
URL
GET
http://127.0.0.1:8000/books/ : Returns a list of books
GET
http://127.0.0.1:8000/books/book/1 : Returns a detail view of the specified book id
GET
http://127.0.0.1:8000/authors/ : Returns a list of authors
GET
http://127.0.0.1:8000/authors/author/1 : Returns a detail view of the specified author id
POST
http://127.0.0.1:8000/authors/author/ : Creates a new author with the specified details - Expects a JSON body
POST
http://127.0.0.1:8000/books/book/ : Creates a new book with the specified details - Expects a JSON body
PUT
http://127.0.0.1:8000/authors/author/1 : Updates an existing author - Expects a JSON body
PUT
http://127.0.0.1:8000/books/book/1 : Updates an existing book - Expects a JSON body -
Success Responses:
- Code:
-
201_Created <br />
-
Error Responses:
- Code: 500 Internal Server Error
-
404_NOT_FOUND <br />
-
400_BAD_REQUEST <br />
-
204_NO_CONTENT <br />
- Code: 500 Internal Server Error
-
Usage Instruction Steps:
- Download the project.
- Install all the dependencies:
Dependencies
3. Run the project:Migrate database: python manage.py makemigrations
python manage.py migrate
Run server : python manage.py runserver
4. Open browser or postman: hit the api's, get the JSON response.
Thanks for reading.