Profile
Retrieves or updates the authenticated customer's profile information.
HTTP Request
Retrieve Profile:
GET/api/shop/customers/me
Update Profile:
PATCH/api/shop/customers/me
Authorization
Authorization
- Required: Yes
- Permission: Authenticated Customer
- Authentication: Token-based (`Authorization: Token <your_api_key>`)
Request Body (PATCH only)
| 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# Get customer profile
4response = requests.get('http://www.example.com/api/shop/customers/me',
5 headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# Update customer profile
10response = requests.patch('http://www.example.com/api/shop/customers/me',
11 json={
12 'first_name': 'John',
13 'last_name': 'Doe',
14 'gender': 'male'
15 },
16 headers={'Authorization': 'Token <your_api_key>'}
17)
18print(response.json())1# Get customer profile
2curl "http://www.example.com/api/shop/customers/me" -H "Authorization: Token <your_api_key>"
3
4# Update customer profile
5curl -X PATCH "http://www.example.com/api/shop/customers/me" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
6 "first_name": "John",
7 "last_name": "Doe",
8 "gender": "male"
9}'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 |