Cert++
Close

Selecting OCAPI settings API type and global versus site context

Key Takeaway

Pick the API type (Shop or Data) by who calls and why, then pick the context by reach. Global applies to all sites, while a site name applies only to that site, so a change for one site belongs in that site's context.

Open Commerce API (OCAPI) settings are JSON documents in Business Manager that grant client applications permission to call OCAPI resources. A client gets no access to a resource until a setting grants it. Before you edit a setting, you make two choices. The first is the API it applies to: Shop or Data. The second is the context: Global for every site in the organization, or a single site. Together, these choices decide which calls a client can make and on which sites.

No access by default

By default, no permission is granted. OCAPI declines any client request that lacks the right permission and returns HTTP 401 (Unauthorized).

Public Shop API data, such as products and prices, follows the same rule. No shopper login is needed for that data, but the system still checks that the client ID is allowed to use the resource.

Priya connects a new headless storefront to a sandbox. The storefront only shows products and prices to anonymous visitors, so she expects no permission check. Her first call with the storefront's client ID returns HTTP 401 (Unauthorized), because no OCAPI setting grants that client ID the resource yet. She adds the resource for that client ID in an OCAPI setting. After the setting takes effect, the call passes the permission check.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Prepare for the Exam

Play Today's Certle

Study Community

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