Use the APIs on instances running multiple sites
If you are running multiple sites on your Commerce instance, your REST calls need to specify which sites they apply to.
There are two ways to specify the site:
- For calls to any of the APIs, you can specify the site using the
x-ccsite
header in the request. - For calls to the Store API, you can explicitly include the domain name of the applicable site in the URL.
Note that if you do not specify a site in a call to the Store API, the call
is directed to the default site. (See Configure sites for a discussion of the default site.) If you
do not specify a site in a call to the Admin API or the Agent API, the call is applied
to the instance as a whole. For example, if you specify a site for the
getOrders
Admin endpoint, only orders associated with that site are
returned; if you do not specify a site, orders associated with all sites are
returned.
x-ccsite
header
You can use the
x-ccsite
header to specify the site for
an API call. For example, if you have two sites, siteA
and
siteB
, you could use this call to return the orders for
siteB
:
GET /ccadmin/v1/orders HTTP/1.1
Authorization: Bearer <access_token>
x-ccsite: siteB