Retrieve Customer
Retrieves detailed information about a specific customer.
HTTP Request
GET/api/customers/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the customer |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3response = requests.get('http://www.example.com/api/customers/123',
4 headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())1curl "http://www.example.com/api/customers/123" \
2-H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Customer retrieved successfully |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 404 | Customer not found |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the customer |
| first_name | String | Customer's first name |
| last_name | String | Customer's last name |
| String | Customer's email address | |
| mobile_number | String | Customer's mobile phone number |
| national_code | String | Customer's national identification code |
| birth_date | String (YYYY-MM-DD) | Customer's birth date |
| gender | String | Customer's gender (male/female) |
| notes | String | Additional notes about the customer |
| is_active | Boolean | Whether the customer account is active |
| is_profile_completed | Boolean | Whether the customer has completed their profile |
| date_joined | String (ISO 8601) | Timestamp when customer was created |
| last_login | String (ISO 8601) | Timestamp of customer's last login (null if never logged in) |
| total_orders | Integer | Total number of orders placed by this customer |
| total_spent | String (Decimal) | Total amount spent by this customer |
Notes
- The customer ID must exist in the system
- Some fields may be null if not provided during customer creation
- total_orders and total_spent are calculated in real-time
- last_login will be null for customers who have never logged in