Update Profile Details
Updates the authenticated customer's profile information.
HTTP Request
Update Profile:
PATCH/api/shop/customers/me
Authorization
Authorization
- Required: Yes
- Permission: Authenticated Customer
- Authentication: Token-based (`Authorization: Token <your_api_key>`)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| username | String | No | Customer's username |
| avatar | String | No | URL to customer's avatar image |
| first_name | String | No | Customer's first name |
| last_name | String | No | Customer's last name |
| gender | String | No | Customer's gender (male, female) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Update customer profile
4response = requests.patch('http://www.example.com/api/shop/customers/me',
5 json={
6 'first_name': 'John',
7 'last_name': 'Doe',
8 'gender': 'male'
9 },
10 headers={'Authorization': 'Token <your_api_key>'}
11)
12print(response.json())1# Update customer profile
2curl -X PATCH "http://www.example.com/api/shop/customers/me" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
3 "first_name": "John",
4 "last_name": "Doe",
5 "gender": "male"
6}'Status Codes
| Code | Description |
|---|---|
| 200 | Profile retrieved/updated successfully |
| 401 | Unauthorized — authentication required |
| 400 | Bad request — validation errors |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the customer |
| username | String | Customer's username |
| mobile_number | String | Customer's phone number (read-only) |
| String | Customer's email address (read-only) | |
| avatar | String | URL to customer's avatar image |
| first_name | String | Customer's first name |
| last_name | String | Customer's last name |
| full_name | String | Customer's full name (computed field) |
| gender | String | Customer's gender |
| is_profile_completed | Boolean | Whether the profile is completed |
Example Response
{
"id": 1,
"username": "behrooz3500",
"mobile_number": "09308744204",
"email": "behrooz21@hotmail.com",
"avatar": "http://127.0.0.1:8000/media/users/avatars/photo22132188258.jpg",
"first_name": "behrooz",
"last_name": "ghorbanie",
"full_name": "behrooz ghorbanie",
"gender": "male",
"is_profile_completed": true
}