PUT users.password - ocariot/api-gateway GitHub Wiki

Description

This route makes it possible to update the users password.

Permissions:

  • Admin, Family, Educator and Health Professional users can update their own password only.

  • Application and Child users cannot have their password updated via this route, their password can only be reset through this route.

Scope

educators:update, families:update, healthprofessionals:update

URL

PUT https://localhost/v1/users/{user_id}/password

Parameters

user_id: string (A 24-byte hex ID)

Request body

{
  "old_password": "old_password_here",
  "new_password": "new_password_here"
}

Curl example

curl -X PUT "https://localhost/v1/users/5a62be07de34500146d9c544/password" -H "accept: /" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d "{"old_password":"old_password_here","new_password":"new_password_here"}"

Response body

  • 204 Operation successfully performed. The password has been updated and no data to be returned.

  • 400 Validation errors

    • Invalid JSON format

    • Invalid user id

    • Missing fields

      • Example
        {
          "code": 400,
          "message": "Required fields were not provided...",
          "description": "old_password, new_password are required!"
        }
        
    • Empty string

      • Example
        {
          "code": 400,
          "message": "One or more request fields are invalid...",
          "description": "old_password must have at least one character!"
        }
        
    • Invalid string

      • Example
        {
          "code": 400,
          "message": "One or more request fields are invalid...",
          "description": "old_password must be a string!"
        }
        
    • Old password does not match current user password

      {
        "code": 400,
        "message": "Password does not match!",
        "description": "The old password parameter does not match with the actual user password."
      }
      
  • 401 Unauthorized Error

  • 403 Permission Error

  • 429 Too Many Requests Error

  • 500 Internal Server Error