Upsert operations are ideal for menu synchronization and bulk updates, allowing you to maintain consistent menu configurations across multiple stores or update existing menus with new operating hours.
Path Parameters
The unique identifier of the store for which to upsert the menu
Query Parameters
The unique identifier of the menu to update, or leave empty to create a new menu
Request Body
Display name for the menu
Whether this menu should be the default menu for the store
Menu status: “active” or “inactive”
Array of operating hours for each day of the week, including existing IDs for updates
Request Example
Upsert Operation Behavior
Upsert Operation Behavior
Create Mode (New Menu)
- When menu_id is not provided or doesn’t exist
- Creates a new menu with all provided configuration
- Generates new IDs for menu and menu hours
- Sets creation timestamps and user information
- When menu_id matches an existing menu
- Updates menu configuration and operating hours
- Preserves existing IDs where provided
- Updates modification timestamps
- Can add new menu hours while updating existing ones
- Removes menu hours not included in the request
- Supports partial updates of operating schedules
- Maintains data integrity during complex changes
Multiple Time Slots: This endpoint supports multiple opening/closing periods for the same day, allowing for complex scheduling like lunch breaks or split shifts.
Efficient Updates: Include existing IDs in menu_hours objects to update existing entries rather than recreating them, which preserves audit trails and related data.
Use Cases
Common Upsert Scenarios
Common Upsert Scenarios
Menu Synchronization
- Sync menu configurations across multiple store locations
- Maintain consistent operating hours across franchise locations
- Update multiple menus with new corporate policies
- Modify operating hours for seasonal changes
- Add special hours for holidays or events
- Implement temporary schedule modifications
- Configure multiple opening periods per day
- Set up lunch break closures or split shifts
- Handle 24-hour operations with midnight transitions
- Apply standardized menu templates to new stores
- Update existing menus to match new corporate standards
- Implement brand-wide menu changes efficiently
Split-Day Operations
Managing Complex Schedules
Managing Complex Schedules
Multiple Time Periods per Day
- Early morning hours (00:00-01:00)
- Regular business hours (10:00-17:00)
- Late evening service (22:00-23:59)
- Morning hours (09:00-12:00)
- Afternoon hours (13:00-17:00)
- Closed period for lunch (12:00-13:00)
- Continuous service across midnight
- Day 0: 22:00-23:59
- Day 1: 00:00-06:00
- Extended hours for promotions
- Limited hours for maintenance
- Holiday-specific operating schedules
Data Validation
Validation Rules and Constraints
Validation Rules and Constraints
Time Format Validation
- Times must be in HH:MM format (24-hour)
- Opening time must be before closing time (within the same day)
- Times must be valid (00:00 to 23:59)
- Must be integers between 0 and 6
- 0 = Sunday, 6 = Saturday
- Each day can have multiple time periods
- Menu name must be non-empty and unique within the store
- Status must be “active” or “inactive”
- is_default must be boolean
- Existing IDs must reference valid menu hours
- menu_id in query parameter must match existing menu for updates
- Invalid IDs will be ignored and new entries created
Error Handling
Common Error Scenarios
Common Error Scenarios
Invalid Menu IDTime Validation ErrorsConflicting Default MenusMissing Required Fields
Data Overwrite: Upsert operations can overwrite existing menu configurations. Ensure you include all desired menu hours in the request, as missing entries may be removed.
Best Practices
Upsert Implementation Best Practices
Upsert Implementation Best Practices
Data Preparation
- Always retrieve current menu configuration before updating
- Include existing IDs to preserve data relationships
- Validate time ranges before submitting requests
- Test complex schedules in staging environment
- Check for time conflicts before submitting
- Validate day_of_week values are within range
- Ensure only one menu per store is set as default
- Handle timezone considerations for multi-location businesses
- Batch multiple menu updates when possible
- Use existing IDs to minimize database operations
- Consider the impact of frequent menu changes on customer experience
- Implement proper error handling and retry logic
- Track who makes menu changes and when
- Maintain history of menu modifications
- Document business justification for schedule changes
- Review menu performance after updates