OCC APIs and integration — SAP Guided Tutorial
Free sample lesson · open to everyone
Using and extending OCC REST APIs, securing them with OAuth clients, controlling response size with fields parameters, and integrating SAP Commerce with ERP and other systems through Integration Suite and integration APIs.
In this lessonShow sectionsHide sections
Visual overview
The situation: a real project scenario
A mobile app requested product lists with fields=FULL, downloading classification, all images and stock for 50 items per page. Response times exceeded 3 seconds. Switching to explicit fields cut payload by 85% and response times below 400 ms.
Explanation
OCC (Omni Commerce Connect) is the REST API layer that storefronts, mobile apps and external integrations use to talk to SAP Commerce, and getting it right is as much about discipline as it is about the endpoints themselves.
Endpoints follow a consistent resource pattern like /occ/v2/{baseSiteId}/products/{code} or /occ/v2/{baseSiteId}/users/{userId}/carts — the base site in the path sets the catalog, currency and language context for that call, which is why the same product code can return different prices depending on which base site it's requested through.
Clients authenticate using OAuth2, and a key practice is giving each consuming application its own OAuth client ID and scope rather than sharing one client across the storefront, mobile apps and integrations — a shared client means you can't tell which caller is responsible for a spike in traffic or a security incident, and you can't revoke one client's access without breaking everyone else.
The fields parameter is the main performance lever on every OCC call: requesting BASIC, DEFAULT or FULL controls how much of the response is populated, and explicit field lists (fields=code,name,price(formattedValue)) let a client ask for exactly what it needs. Defaulting to FULL on every call — especially list endpoints returning many items — pulls back classification data, every image variant, and other payload a client may not even render, which directly shows up as slower responses and wasted bandwidth, particularly painful on mobile networks.
OCC is extended, not modified: new attributes get added to existing DTOs through populators (so a new field appears on an existing resource without changing its meaning for other consumers), and genuinely new resources get their own controllers in custom extensions. Both should be documented and treated as additive — removing or repurposing an existing field in a DTO that other clients already depend on breaks them silently.
On the back-end integration side, orders, customers, products, prices and stock typically flow to and from the ERP through SAP Integration Suite or the platform's own integration API modules, and because any integration can fail transiently, production-grade integrations need monitoring and the ability to safely replay a failed message — which means the receiving side needs to handle the same message arriving twice without creating duplicates (idempotency).
Code example
GET /occ/v2/electronics/products/CAM-1001?fields=code,name,price(formattedValue),stock(stockLevelStatus)Authorization: Bearer <access_token>Watch out
Common mistakes
Requesting fields=FULL for every call, including list endpoints returning dozens of items, when only a handful of fields are actually used: this is one of the most common and easiest to fix causes of slow OCC responses — switching to explicit field lists routinely cuts payload size dramatically.
Sharing a single OAuth client across the storefront, mobile app and backend integrations: this removes the ability to tell which client is responsible for abnormal traffic or to revoke one consumer's access without taking down the others.
Changing the meaning of an existing standard DTO field instead of adding a new one via a populator: this silently breaks every other consumer of that endpoint who was relying on the original meaning.
Building integrations without monitoring or replay capability: a transient ERP outage then becomes a permanently lost order or price update instead of a message that gets safely retried.
Do this
Best practices
Use explicit field lists tuned to what each client actually renders, rather than defaulting to FULL, especially on high-traffic and mobile-facing endpoints — this is usually the single biggest, cheapest performance win available on OCC. Give each consuming application (storefront, mobile app, each integration) its own OAuth client with least-privilege scopes, so access can be audited and revoked per consumer.
Extend DTOs additively through populators and keep new resources in custom extensions with versioned, documented contracts, so existing consumers are never broken by a change meant for one new client. Build integration monitoring and idempotent replay into any ERP integration from the start, since transient failures are a certainty over the life of a production system, not an edge case.
In the interview
Interview angle
A practical OCC question is 'A mobile team complains the product list API is slow — what do you check first?' A weak answer guesses at database tuning.
A strong answer checks the fields parameter the client is requesting first, since fields=FULL on a list endpoint is by far the most common cause of this exact complaint, and can usually be confirmed and fixed in minutes by comparing response size and latency between FULL and an explicit field list.
A candidate who immediately reaches for the fields parameter, and who can also explain why separate OAuth clients per consumer matter for more than just security (traffic attribution, independent revocation), shows hands-on OCC experience rather than textbook knowledge.
Practice this lesson
Original educational case studies for SAP consultants, not official SAP certification exam questions. Verify product edition and implementation details against the current SAP documentation.
Quick check
0 of 4 questions attempted
Question 1 of 4
What does the OCC fields parameter control?
Question 2 of 4
How should a mobile app and an ERP integration authenticate to OCC?
Question 3 of 4
How do you add a custom attribute to an OCC product response?
Question 4 of 4
Which path element sets catalog, currency and language context in OCC?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1How do you design and secure OCC usage for multiple channels?
2How do you integrate SAP Commerce Cloud with S/4HANA?
Was this lesson helpful?
Keep exploring
More lessons in this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.