Cert++
Close

Reducing OCAPI round trips and response payload size

Key Takeaway

To make fewer OCAPI calls, use a batch request or expand. To get smaller responses, use select. To skip calls for unchanged data, reuse it until the Cache-Control max-age value runs out.

Every OCAPI call costs a network round trip and server work. Oversized responses also waste bandwidth. B2C Commerce gives developers request-level tools to cut both. Batch requests bundle many calls into one. The select parameter trims a response to only the properties you need. The expand parameter pulls related product data into a single response. Many Shop API responses also carry Cache-Control headers that tell a client how long it can reuse data before it calls again.

Match the tool to the problem

Start by naming the problem, because each tool fixes a different one.

ProblemTool
Too many callsA batch request or the expand parameter
Too much data in each responseThe select parameter
Repeated calls for unchanged dataHonor the Cache-Control max-age value
B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given a business requirement, use OCAPI Shop and Data APIs to enable interoperability with an external system

0/10

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers.