Update User Data
Update Contact Phone Number
For updating the contact phone number linked to the main account, you have to call the register API and provide the new phone number and the unique identifier for the user.
Note: This is a server-server API, you can't use it from the client-side.
curl --location 'registerAPI' \
--header 'access-token: SERVER_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"policy_number": "111111111",
"phone_number": "+966123456789",
"insurance_id": "123123123"
}'
updateUser
For updating a user's data from the client-side you need to use updateUser and provide the UserType data object along with the user_id.
Parameters
- user: (UserType) - The user data object with the updated fields.
- user_id: (string) - The ID of the user to update.
Returns
Promise<ResponseType<UserType>>: A promise that resolves with the updatedUserTypeobject.
Example
import { updateUser } from 'react-web-altibbi';
const data: UserType = {
email: '[email protected]',
};
const response = await updateUser(data, '999999999');
Responses
Status 200
Success
{
"id": 999999999,
"name": "Altibbi User",
"email": "[email protected]",
"phone_number": "0791234567",
"date_of_birth": "2000-01-30",
"gender": "male",
"insurance_id": "123123123",
"policy_number": "111111111",
"nationality_number": "9999999999",
"height": "180",
"weight": "90",
"blood_type": "A+",
"smoker": "yes",
"alcoholic": "no",
"marital_status": "single",
"relation_type": "brother",
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-01 00:00:00"
}
Status 401
UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.
{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\web\\UnauthorizedHttpException"
}
Status 422
Data Validation Failed.
[
{
"field": "string",
"message": "string"
}
]