Update User Data
This API will be used to update the ordinary user data profile data which won't affect the security. It can't update the information like 2FA, Username, Email, Email, Password, Timezone etc. Even if these values are submitted to update, the server will ignore these properties and only update those which are permitted.
Endpoint
GET /user/updatePayload
In the payload, the same properties need to be sent with different values to update. There are 2 important things to be noted about it;
- You don't need to submit full user object along with previous and the new values. Just submit those values which you need to update.
- But the to update the
imagewill be a little different. You will need to first upload the image on the S3 cloud using separate API which will return you back the relative url of the image, then update that url in this API. Please refer the Image Upload API.
1
2
3
4
5
6
7
8
9
{
"image": "/user-profiles/65ddb7496a09ca290bec88b2", // Remeber that in order to update the image url, first you need to upload the image using a separate API and then update the url in here.
"phone_prefix": "+971",
"phone_number": "31643454835",
"title": "Mr."
"firstname": "Alice",
"lastname": "Davidson",
"gender": "other",
}Response
In response, you'll get the full user object with all the updated latest values which you can unhesitantly update in your local storage/state.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"success": true,
"msg": "Your data has been updated successfully",
"user": {
"_id": "65ddb7496a09ca290bec88b2",
"username": "user_123",
"register_provider": "urbanfits",
"image": "/user-profiles/65ddb7496a09ca290bec88b2",
"phone_prefix": "+971",
"phone_number": "31643454835",
"email": "example@domain.com",
"two_fa_enabled": false,
"role": "customer",
"is_active": true,
"uf_wallet": {
"card_number": "70517090291921247656",
"bar_code": "/uf-wallet-barcodes/70517090291921247656",
"last_spin_reward": 200,
"last_uf_spin": "2024-05-09T23:59:59.000Z",
"next_uf_spin": "2024-05-11T00:00:00.000Z"
},
"last_checkin": "2024-05-21T23:59:59.999Z",
"timezone": "Asia/Dubai",
"user_agent": "eyJhbGciOiJIUzI1NiJ9.UG9zdG1hblJ1bnRpbWUvNy4zNy4z.lYd97Uv60STIestaaO3UO_aiP7G10yEmi_XG22KbOPo",
"purchases": 7,
"createdAt": "2024-02-27T00:00:00.000Z",
"updatedAt": "2024-06-06T12:04:37.382Z",
"__v": 0,
"title": "Mr."
"firstname": "Alice",
"lastname": "Davidson",
"gender": "other",
}
}