REST Composite, Bulk API 2.0 or a custom Apex REST service for a partner that sends 5,000 orders with lines every hour?
Your confidence:Not rated
Model answer
- Composite / sObject Collections: up to 200 records per collection call or 25 subrequests per composite. 5,000 orders with lines means many calls per hour, consuming API allocation, but responses are immediate and per record.
- Bulk API 2.0: efficient for volume and API usage, asynchronous, CSV-based. Parent-child creation needs external IDs and two jobs (orders, then lines). Errors come back in result files later.
- Custom Apex REST: one call per order (or per batch of orders) with business validation and one transaction per order. Clean contract, but you own the code and governor limits per call.
Recommendation: for hourly bulk drops, Bulk API 2.0 with external IDs (orders then lines), plus a reconciliation step and an error file returned to the partner. If the partner needs immediate per-order acceptance with business validation, a custom Apex REST endpoint taking small batches of orders. Avoid one REST call per record.
โ Key points to hit
โ Red-flag answers
- One REST call per record
- Bulk API when the partner needs instant validation
โช Follow-ups
How do you return Bulk API errors to the partner?
Middleware reads the failedResults file, maps errors to the partner's order IDs and sends a rejection report or callback, so they can correct and resend.
What protects Salesforce from a partner flooding the API?
Rate limiting in middleware or an API gateway, per-integration-user monitoring, and contractual limits. Salesforce enforces org-wide limits, so one partner can't be allowed to exhaust them.