Skip to main content
PUT
/
users
/
{id}
curl -X PUT https://api.library.com/users/1 \
  -u username:password \
  -H "Content-Type: application/json" \
  -d '{
    "firstname": "John",
    "lastname": "Doe",
    "email": "[email protected]",
    "displayPicture": "https://example.com/pictures/johndoe-new.jpg"
  }'
{
  "200": {},
  "400": {},
  "401": {},
  "404": {},
  "409": {},
  "id": 123,
  "firstname": "<string>",
  "lastname": "<string>",
  "email": "<string>",
  "borrowedBooks": [
    {
      "id": 123,
      "user": {},
      "book": {},
      "loanDate": "<string>",
      "returnDate": "<string>",
      "returned": true
    }
  ],
  "googleId": "<string>",
  "displayPicture": "<string>"
}

Authentication

This endpoint requires HTTP Basic Authentication.

Path Parameters

id
long
required
The unique identifier of the user to update

Request Body

This endpoint performs a full update, replacing all user fields. All fields should be provided.
firstname
string
The user’s first name
lastname
string
The user’s last name
email
string
required
The user’s email address. Must be unique.
password
string
The user’s password. Will be encrypted before storage.
googleId
string
Optional Google OAuth ID for users signing in with Google
displayPicture
string
URL to the user’s display picture
This is a full update (PUT) operation. To perform a partial update where only specified fields are modified, use the PATCH endpoint instead.

Response

id
long
Unique identifier for the user
firstname
string
The user’s first name
lastname
string
The user’s last name
email
string
The user’s email address
borrowedBooks
array
Set of rental records for books borrowed by this user
googleId
string
Google OAuth ID (only included if set)
displayPicture
string
URL to the user’s display picture (only included if set)

Status Codes

200
OK
User successfully updated
400
Bad Request
Invalid request body or missing required fields
401
Unauthorized
Missing or invalid authentication credentials
404
Not Found
User with the specified ID does not exist
409
Conflict
Email address already exists for another user
curl -X PUT https://api.library.com/users/1 \
  -u username:password \
  -H "Content-Type: application/json" \
  -d '{
    "firstname": "John",
    "lastname": "Doe",
    "email": "[email protected]",
    "displayPicture": "https://example.com/pictures/johndoe-new.jpg"
  }'

Build docs developers (and LLMs) love