Gestion de Bibliotique
Home
API
  • Client > Authentification
  • Client > Profile
  • Client > CRUD
  • Livres
  • Emprunts
  • Categories
Team
  • Nassim MZILI
  • Abderrahim El Ouali
Home
API
  • Client > Authentification
  • Client > Profile
  • Client > CRUD
  • Livres
  • Emprunts
  • Categories
Team
  • Nassim MZILI
  • Abderrahim El Ouali
GitHub
GitLab
  1. Emprunts
  • Get Started
  • API
    • Clients
      • Auth
        • Register a new client
        • Login a client
        • Logout a client
      • Profile
        • Update client profile
        • Update client password
        • Get client details
        • Get all emprunts for a client
      • CRUD (Admin)
        • Get all clients
        • Get a client by ID
        • Update a client
        • Delete a client
    • Livres
      • Get all books
      • Get a book by ID
      • Add a new book
      • Update a book
      • Delete a book
    • Emprunts
      • Create a new emprunt
        POST
      • Get emprunt by ID
        GET
      • Update an emprunt
        PUT
      • Delete an emprunt
        DELETE
      • Get all emprunts
        GET
      • Get all emprunts for a specific client
        GET
      • Return a book
        POST
    • Categories
      • Get all categories
      • Get a category by ID
      • Add a new category
      • Update a category
      • Delete a category
  1. Emprunts

Update an emprunt

PUT
https://gestion-bibliotique-pfe.netlify.app/api/emprunts/{id}
Maintainer:Nassim MZILI

@access Admin#

Request

Path Params
id
string 
required
Example:
67b54e2cbb49979f9658c5ed
Header Params
Authorization
string 
required
Example:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3YjM5ODM0NTc1N2EyYTY4MWU5Njc4OSIsInJvbGUiOiJjbGllbnQiLCJpYXQiOjE3Mzk5MzUyNjIsImV4cCI6MTc0MDAyMTY2Mn0.E9iCD1yeA-Z5-4IMrB37-d9aDPL3cRiB1LlnmpxfPhI
Body Params application/json
statut
string 
required
dateRetourPrevu
string 
required
Example
{
  "statut": "en cours",
  "dateRetourPrevu": "2025-11-28T14:20:51.317Z"
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request PUT 'https://gestion-bibliotique-pfe.netlify.app/api/emprunts/67b54e2cbb49979f9658c5ed' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3YjM5ODM0NTc1N2EyYTY4MWU5Njc4OSIsInJvbGUiOiJjbGllbnQiLCJpYXQiOjE3Mzk5MzUyNjIsImV4cCI6MTc0MDAyMTY2Mn0.E9iCD1yeA-Z5-4IMrB37-d9aDPL3cRiB1LlnmpxfPhI' \
--header 'Content-Type: application/json' \
--data-raw '{
    "statut": "en cours",
    "dateRetourPrevu": "2025-11-28T14:20:51.317Z"
}'

Responses

🟢200Success
application/json
Body
success
boolean 
required
message
string 
required
data
object 
required
emprunt
object (Emprunt) 
required
Example
{
  "success": true,
  "message": "Emprunt updated successfully!",
  "data": {
    "emprunt": {
      "_id": "2ApNmk8YtEVcNbvwlB75R",
      "clientId": "Mz1Mu9fk7ETr1WsFh2dFV",
      "livreId": "e69aC5CweZ-ZQk2QWdUYz",
      "dateRetourPrevu": "2025-10-12T16:42:16.011Z",
      "statut": "retourné",
      "dateEmprunt": "2025-02-19T03:50:21.131Z",
      "dateRetourEffectif": "2024-04-08T05:27:09.671Z"
    }
  }
}
🟠400Bad Request
🟠401Unauthorized
🟠403Forbidden
🟠404Record Not Found
🔴500Server Error
Previous
Get emprunt by ID
Next
Delete an emprunt
Built with