I’ll provide a complete solution addressing all three focus areas:
Date/Time Format Validation:
Epicor demand planning API has strict date format requirements that vary based on forecast granularity:
-
Monthly Forecasts:
- forecastPeriod: “YYYY-MM” (e.g., “2024-12”)
- item date: “YYYY-MM-01” (must be first day of month, no time component)
- Invalid: “2024-12-15”, “2024-12-01T00:00:00Z”, “12/01/2024”
-
Weekly Forecasts:
- forecastPeriod: “YYYY-Www” (e.g., “2024-W48” for week 48)
- item date: “YYYY-MM-DD” (must be Monday of the week)
- Example: “2024-11-25” (Monday of week 48)
-
Daily Forecasts:
- forecastPeriod: “YYYY-MM” (month containing the forecasts)
- item date: “YYYY-MM-DD” (any valid day)
- Time component is ignored if provided
Critical Rules:
- Never include time components (T00:00:00) or timezone indicators (Z, +00:00)
- All dates must align with the forecast calendar configured in Demand Planning > Configuration
- Dates must fall within the planning horizon (typically 12-24 months from current date)
- forecastPeriod must match the earliest item date’s period
REST API Payload Requirements:
Correct payload structure for monthly forecasts:
POST /api/v1/forecasts/upload
{
"forecastPeriod": "2024-12",
"forecastType": "STATISTICAL",
"planningGroup": "FG-PRODUCTS",
"items": [
{
"sku": "PROD-001",
"quantity": 1000,
"date": "2024-12-01",
"uom": "EA"
},
{
"sku": "PROD-002",
"quantity": 1500,
"date": "2025-01-01",
"uom": "EA"
}
]
}
Required fields:
- forecastPeriod: Starting period for the forecast data
- items: Array of forecast items (max 1000 per request)
- items[].sku: Product SKU (must exist in product master)
- items[].quantity: Forecast quantity (positive decimal)
- items[].date: Forecast date (format per granularity rules)
Optional but recommended:
- forecastType: “STATISTICAL”, “CONSENSUS”, or “OVERRIDE” (default: STATISTICAL)
- planningGroup: Used for filtering/organizing forecasts
- items[].uom: Unit of measure (default: base UOM from product master)
- items[].confidence: Confidence level 0-100 (default: 80)
Forecast Data Integration Best Practices:
- Excel Date Handling:
Excel stores dates as serial numbers. When converting to JSON:
# Python example
import pandas as pd
from datetime import datetime
# Read Excel
df = pd.read_excel('forecast.xlsx')
# Convert Excel dates to proper format
df['date'] = pd.to_datetime(df['date']).dt.strftime('%Y-%m-01')
# Ensure all dates are first of month for monthly forecasts
df['date'] = df['date'].apply(lambda x:
datetime.strptime(x, '%Y-%m-%d').replace(day=1).strftime('%Y-%m-%d')
)
- Validation Before Upload:
Implement pre-upload validation:
- Verify date format matches configured granularity
- Check all SKUs exist in Epicor product master
- Validate quantities are positive
- Ensure dates fall within planning horizon
- Confirm forecastPeriod matches earliest item date
- Error Handling:
API returns detailed validation errors:
{
"error": "Invalid date format",
"details": [
{
"field": "items[2].date",
"value": "2024-12-15",
"message": "Date must be first day of month for monthly forecasts"
}
]
}
Parse the details array to identify which specific items failed validation.
- Batch Processing:
For large forecast files:
- Split into batches of 500-1000 items per API request
- Process batches sequentially with 2-second delay between requests
- Log failed items for manual review
- Implement retry logic for transient errors (HTTP 5xx)
- Date Consistency:
Maintain a date format configuration file:
{
"granularity": "monthly",
"forecastPeriodFormat": "YYYY-MM",
"itemDateFormat": "YYYY-MM-01",
"planningHorizonMonths": 18
}
Use this configuration across all forecast upload processes to ensure consistency.
- Testing Strategy:
Before deploying forecast automation:
- Test with single-item payloads to verify date format acceptance
- Test boundary dates (first/last day of planning horizon)
- Test mixed granularities if you use multiple forecast types
- Validate against Epicor’s forecast calendar (holidays, fiscal periods)
After implementing these date format rules and validation practices, your forecast upload success rate should reach 98%+. The key is aligning your date formats with Epicor’s granularity configuration and always using the first day of the period for monthly forecasts.