4👍
✅
You have used ModelViewSet
for controlling api.
Which provides you following urls as per your declaration.
<host>/api/etudiants/
POST<host>/api/etudiants/<Etudiant id>/
DELETE<host>/api/etudiants/<Etudiant id>/
PUT<host>/api/etudiants/<Etudiant id>/
PATCH<host>/api/etudiants/<Etudiant id>/
GET<host>/api/etudiants/
GET (List endpoint)
Deletion: You may use <host>/api/etudiants/<Etudiant id>
replace <Etudiant id>
with your Etudiant
object’s id and call DELETE
http method on that endpoint.
Creation: Use <host>/api/etudiants/
add json payload then call POST
http method on that endpoint.
If this would not help you than put your comment below.
Source:stackexchange.com