API Documentation
Overview
The Customer Management API provides comprehensive endpoints for managing customer information, relationships, and interactions within the Bee O'clock panel service. This API enables businesses to maintain customer records, handle attendee management, and support order-customer relationships with robust validation and data integrity.
Base URL
{base_url}/v1/customerAuthentication
All endpoints require authentication via Bearer token and business tenant ID header.
Authorization: Bearer {access_token}
x-business-tenant-id: {tenant_id}Core Endpoints
1. Get Paginated Customers
Retrieves a paginated list of customers for the authenticated business.
Endpoint: GET /paged
Headers:
Query Parameters:
Response:
Example Request:
Example Response:
Error Responses:
2. Get Customer by ID
Retrieves detailed information for a specific customer.
Endpoint: GET /{id}
Path Parameters:
id(string, required): Customer ID
Response:
Example Request:
Example Response:
Error Responses:
3. Create Customer
Creates a new customer record with validation.
Endpoint: POST /
Request Body:
Validation Rules:
At least one of:
firstName,lastName,email, orphonemust be providedEmail must be valid format if provided
Phone must be valid format if provided (automatically normalized)
Customer type defaults to 'regular'
Response:
Example Request:
Example Response:
Error Responses:
4. Update Customer
Updates an existing customer record with partial updates supported.
Endpoint: PUT /{id}
Path Parameters:
id(string, required): Customer ID to update
Request Body:
Response:
Example Request:
Example Response:
5. Delete Customer
Soft deletes a customer record (sets state to inactive).
Endpoint: DELETE /{id}
Path Parameters:
id(string, required): Customer ID to delete
Response:
Example Request:
Success Response:
Error Responses:
Data Transfer Objects
CustomerDto
CustomerPaginationDto
Enumerations
CustomerTypeEnum
Customer-Order Relationships
Order Integration
Customers are integrated with orders through the attendee system:
Payment Integration
Customers are captured in payment records:
Validation Rules
Customer Creation Validation
Mandatory Fields: At least one of
firstName,lastName,email, orphonerequiredEmail Validation: Must match regex pattern for valid email format
Phone Validation: Must match international phone number pattern
Phone Normalization: Automatically extracts and stores only numbers
Duplicate Prevention: Prevents duplicate customers based on email/phone combination
Business Rules
Customer Types:
regular: Standard registered customers with full profileunregistered: Customers without full registrationnew: First-time customersanonymous: Anonymous public order customers
Data Integrity:
Customer data is snapshotted in orders and payments
Updates to customer records don't affect historical data
Soft deletion preserves data for reporting and history
Multi-tenancy:
All operations are tenant-scoped
Customers are isolated per business tenant
No cross-tenant data access
Error Handling
Common Error Codes
400
Validation Error
Invalid request data or missing required fields
401
Unauthorized
Invalid or missing authentication token
403
Forbidden
Insufficient permissions for operation
404
Not Found
Customer not found
409
Conflict
Duplicate customer or business rule violation
422
Unprocessable Entity
Valid request but business logic prevents execution
500
Internal Server Error
Unexpected server error
Error Response Format
Security Considerations
Authentication & Authorization
Bearer Token Required: All endpoints require valid JWT token
Tenant Isolation: Strict tenant-based data separation
Permission Validation: Role-based access control for operations
Audit Logging: All customer operations are logged for security
Data Protection
PII Handling: Customer data treated as Personally Identifiable Information
GDPR Compliance: Support for data portability and deletion rights
Encryption: Sensitive data encrypted at rest and in transit
Access Logging: Customer data access is logged and monitored
Rate Limiting
API Rate Limits: Standard rate limiting applied to all endpoints
Bulk Operations: Special consideration for pagination and bulk retrieval
Search Optimization: Search queries optimized to prevent performance issues
Performance Considerations
Database Optimization
Indexing: Optimized indexes on frequently queried fields
Pagination: Efficient cursor-based pagination for large datasets
Caching: Redis caching for frequently accessed customer data
Query Optimization: Selective field projection for list operations
Caching Strategy
Integration Examples
Customer Creation Flow
Order Attendee Integration
Customer Search and Selection
Testing Examples
Unit Testing
Summary
The Customer Management API provides a robust foundation for managing customer relationships within the Bee O'clock ecosystem. Key features include:
Comprehensive CRUD Operations with validation and error handling
Advanced Search and Pagination for efficient customer discovery
Strong Data Validation ensuring data quality and consistency
Integration Support for orders, payments, and appointments
Multi-tenant Architecture with proper data isolation
Performance Optimization through caching and efficient querying
Security Compliance with authentication, authorization, and audit logging
The API supports complex business scenarios including customer-order relationships, payment processing, and historical data preservation while maintaining high performance and data integrity standards.
Last updated
Was this helpful?