OCAPI resource URL structure and API versioning
Key Takeaway
An OCAPI URL is a base URL that picks the instance, the site and the API, followed by an extended URL that starts with the version written with an underscore, such as v24_5.
The Open Commerce API (OCAPI) lets external systems read and change B2C Commerce data through REST URLs that follow a fixed pattern. Every URL joins a base URL, which picks the instance, the site and the API, with an extended URL, which picks the API version, the resource and the operation. The version is part of every path, so the API can change over time without breaking client applications built on an older version.
The base URL
The base URL is the same for all API requests. You write it differently for production and non-production instances.
If you call a production instance...
The base URL is http(s)://{public_domain}[/s/site_id]/dw/{api_type}/. Here {public_domain} is the DNS name mapped to the site, for example www.example.com. The /s/{site_id} segment is optional.
If you call a non-production instance (staging, development or a sandbox)...
The base URL is http(s)://{domain}/s/{site_id}/dw/{api_type}/. The site ID is always in the path. Here {site_id} is the ID of the site to use, for example SiteGenesis.
{api_type} is shop, data or meta, so the same instance serves the Shop API under /dw/shop/, the Data API under /dw/data/ and the Meta API under /dw/meta/.