From b5ef9beceac9c1a7d31b80b5c05e423772754d16 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Thu, 15 Jul 2021 16:55:37 +0200 Subject: [PATCH] Update README.md --- README.md | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 120 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 69125c3..a77fe28 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,138 @@ # Example of CRUD in Django with REST FRAMEWORK -All endpoints contain your test. +- Live Demo. +- Endpoint Get List Books. +- Endpoint Get Details Book. +- Endpoint Add Book. +- Endpoint Update Book. +- Endpoint Delete Book. +- All Endpoints contain your test. ## Live Demo -https://example-of-crud-in-django-jrf.herokuapp.com/ - ### Get list +``` shell +curl https://example-of-crud-in-django-jrf.herokuapp.com/api/book/ +``` + +Output + +``` json +[ + { + "id": 1, + "title": "Things Fall Apart", + "country": "Nigeria", + "year": 1958, + "author": "Chinua Achebe", + "created_at": "2021-07-15T14:27:14.927177", + "updated_at": "2021-07-15T14:27:14.927213" + }, + { + "id": 2, + "title": "Fairy tales", + "country": "Denmark", + "year": 1836, + "author": "Hans Christian Andersen", + "created_at": "2021-07-15T14:27:14.930223", + "updated_at": "2021-07-15T14:27:14.930233" + }, + ... +``` + ### Get Detail +``` shell +curl https://example-of-crud-in-django-jrf.herokuapp.com/api/book/1/ +``` + +Output + +``` json +{ + "id": 1, + "title": "Things Fall Apart", + "country": "Nigeria", + "year": 1958, + "author": "Chinua Achebe", + "created_at": "2021-07-15T14:27:14.927177", + "updated_at": "2021-07-15T14:27:14.927213" +} +``` + ### Create +``` shell +curl -XPOST -H "Content-type: application/json" -d '{"title": "The foundation", "country": "eeuu", "author": "Isaac Asimov", "year": "1951"}' https://example-of-crud-in-django-jrf.herokuapp.com/api/book/ +``` + +Output + +``` json +{ + "id": 101, + "title": "The foundation", + "country": "eeuu", + "year": 1951, + "author": "Isaac Asimov", + "created_at": "2021-07-15T14:47:25.262738", + "updated_at": "2021-07-15T14:47:25.262753" +} +``` + ### Update +``` shell +curl -XPUT -H "Content-type: application/json" -d '{"title": "The End of Eternity", "country": "eeuu", "author": "Isaac Asimov", "year": "1955"}' https://example-of-crud-in-django-jrf.herokuapp.com/api/book/1/ +``` + +Output + +``` json +{ + "id": 1, + "title": "The End of Eternity", + "country": "eeuu", + "year": 1955, + "author": "Isaac Asimov", + "created_at": "2021-07-15T14:47:25.262738", + "updated_at": "2021-07-15T14:50:47.697224" +} +``` + ### Delete +``` shell +curl -XDELETE https://example-of-crud-in-django-jrf.herokuapp.com/api/book/101/ +``` + +Output + +``` json +{ + "id": null, + "title": "The End of Eternity", + "country": "eeuu", + "year": 1955, + "author": "Isaac Asimov", + "created_at": "2021-07-15T14:47:25.262738", + "updated_at": "2021-07-15T14:50:47.697224" +} +``` + +### Ping + +``` shell +curl https://example-of-crud-in-django-jrf.herokuapp.com/ping/ +``` + +Output + +``` json +{"ping": "pong!"} +``` + ## Install ``` bash