Access site through APIs
For marketers
In Acoustic Content, you can map individual sites to individual hostnames. The sites can be managed with the authoring sites service API. After you set a domain name, either your custom domain or the Acoustic provided shared domain for your site, Content defines the base URLs for doing API calls and accessing static resources of your site. Every API call to Content can run in the context of the site, where individual APIs can scope their results to the site identified by the site context. When you access a domain that is mapped to a site, Content automatically associates a corresponding site context to all API calls routed through that domain.
Before you begin
To get started, you need:
- Your Acoustic Content trial or standard edition. To get a free trial version or to upgrade to standard, go to Acoustic Content.
- Install a Node environment with a recent stable version greater than Node >= 8.
- Acoustic Content developer tools. For more information on how to download and install the Content tools, see[Site application readme] (https://github.com/acoustic-content-samples/wch-site-application/blob/master/README.md).
Address your site content through the API base URL
The API base URL is the base to use for making API calls and has the format of https://your_domain/
For example, the API base URL format:
- when making calls with custom domains: https://greenwheels.com/api/.
- when you do not have a custom domain yet and use the initial Acoustic provided shared host: https://content-XX-N.content-cms.com/api//.
You can use the API base URL to initialize your wchtools client for scripting access to Content. If you are using multiple domain names, you can use any of your domains. All domains serve the same data except for site-aware delivery APIs. The dedicated routes of site-aware delivery APIs allow access to the specific site context that is associated with the used domain. For more information, see the API documentation.
Access your site content through the resource base URL
The resource base URL is used to directly serve your web assets and managed assets by path and has the format of https://your_domain/.
For example, the resource base URL format:
- When making calls with custom domains: https://greenwheels.com/.
- When you do not have a custom domain yet and use the initial Acoustic provided shared host: https://content-XX-N.content-cms.com//.
The resource base URL also addresses your JavaScript application that is hosted on your Content. All domains serve the same resources, but your JavaScript application can use site-aware API calls to open dedicated websites based on the site mapping of the domain.
Note:
As soon as you created your first custom domain, the initial host content-XX-cms.content-cms.com that was assigned to you during onboarding is no longer available.
Addressing sites for any domain through URL path
Calling Content APIs in site context is not limited to using a custom domain to site mappings. It is also possible to address any site on any domain by using a corresponding site-specific base URL.
You can extend the global base URLs (API base URL: https://greenwheels.com/api/ and resource base URL: https://greenwheels.com/) used to call Content APIs in the context of a specific site independent of the domain you are using.
The extension consists of a URL path fragment of the following format "/dxsites/<site.contextRoot>" or "/dxsites/<site.siteId>.
For example for addressing a site with context root "site1" on a initial shared host you can use base URLs like this:
- API base URL: https://content-XX-N.content-cms.com/api/< tenant-id >/dxsites/site1/
- Resource base URL: https://content-XX-N.content-cms.com/< tenant-id >/dxsites/site1/
Or with custom domains:
- API base URL: https://greenwheels.com/api/dxsites/site1
- Resource base URL: https://greenwheels.com/dxsites/site1
Expected outcome
Whether you map your content to a custom domain name, use the default domain, or the Acoustic provided shared host, you can access your site in a web browser and their static resources through the Content APIs.
Updated over 1 year ago