Skip to main content
PUT
/
users
/
:id
curl --location --request PUT 'https://api.maytravel.com/users/1' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username": "johnupdated",
    "email": "johnupdated@example.com",
    "password": "newsecurepassword123"
  }'
{
  "mssg": "User ID 1 updated succesfully"
}

Request

id
integer
required
The unique identifier of the user to update
username
string
required
The new username for the user. Will be converted to lowercase.
email
string
required
The new email address for the user. Will be converted to lowercase.
password
string
required
The new password for the user
curl --location --request PUT 'https://api.maytravel.com/users/1' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username": "johnupdated",
    "email": "johnupdated@example.com",
    "password": "newsecurepassword123"
  }'

Response

mssg
string
Success message confirming the user update
{
  "mssg": "User ID 1 updated succesfully"
}

Error Responses

error
string
Error message describing what went wrong

Status Codes

  • 200 - Success: User successfully updated
  • 404 - Not Found: User with specified ID does not exist
  • 500 - Server Error: Internal server error occurred

Notes

  • Both username and email are automatically converted to lowercase before storage
  • All three fields (username, email, password) must be provided in the request body
  • This endpoint uses a validation middleware (validateInfo) to ensure data integrity
  • The user must exist before attempting to update

Build docs developers (and LLMs) love