UpdateUser

PUT /users

Update the information of an existing user. action: updateimage - To update the image updateprofile - To update firstName, lastName and location updatedate - To update the date of birth updateemail - To update mail updatepass - To update the password

Query parameters

  • action string Required

    We send the action we want to do

    Values are updateimage, updateprofile, updatedate, updateemail, or updatepass.

application/json

Body

Patch user properties to update.

  • firstName string

    Minimum length is 2, maximum length is 20.

  • lastName string

    Minimum length is 2, maximum length is 20.

  • email string(email)

    If a new email is given, the user's email verified property will be set to false.

  • dateOfBirth string(date)
  • location string
  • image string(uri)
  • password string

    Minimum length is 8, maximum length is 25.

Responses

  • 200 application/json

    User Updated

    Hide response attributes Show response attributes object
    • _id string Required

      Unique identifier for the given user.

    • firstName string Required

      Minimum length is 2, maximum length is 30.

    • email string(email) Required
    • username string Required

      Unique identifier for the given user.

    • password string(password) Required
    • lastName string Required

      Minimum length is 2, maximum length is 30.

    • dateOfBirth string(date-time) Required
    • emailVerified boolean

      Set to true if the user's email has been verified.

    • createDate string(date)

      The date that the user was created.

    • location string
    • image string
  • 400

    Bad Request

  • 401

    Unauthorized

  • 409

    This email already exists

  • 500

    Internal Server Error

PUT /users
curl \
 --request PUT 'https://garden-to-yours.herokuapp.com/users?action=updateimage' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"lastName":"De los palotes","location":"Talavera de la Reina","firstName":"Pepito"}'
Request examples
{
  "lastName": "De los palotes",
  "location": "Talavera de la Reina",
  "firstName": "Pepito"
}
{
  "dateOfBirth": "1985-10-02"
}
{
  "image": "https://dominio.com/imagen/dasda.jpg"
}
{
  "email": "newemail@hotmail.es"
}
{
  "password": "newpassword"
}
Response examples (200)
{
  "_id": "string",
  "email": "user@example.com",
  "image": "string",
  "lastName": "string",
  "password": "pa$$word",
  "username": "string",
  "firstName": "string",
  "createDate": "2019-08-24",
  "dateOfBirth": "2000-08-24T00:00:00.000Z",
  "emailVerified": true
}