Skill Level: Any
In IBM Watson Content Hub, you can map individual sites to individual host names.¬† The sites in your hub can be managed with the Authoring sites service API. After you set a domain name, either your custom domain or the IBM provided shared domain for your site, Watson content hub defines the base URLs for doing API calls and accessing static resources of your site. Every API call to Watson Content Hub can run in 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, Watson Content Hub¬† automatically associates a corresponding site context to all API calls routed through that domain.
To get started, you need:
- Your IBM Watson Content Hub Trial or Standard edition with your own IBMid. To get a free Trial version or to upgrade to Standard, go to IBM Marketplace.
- Install a Node environment with a recent stable version greater than Node >= 8.
- IBM Watson Content Hub developer tools. For more information on how to download and install the WCH tools, see https://github.com/ibm-wch/wchtools-cli/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 against your hub 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 IBM provided shared host : https://myX.digitalexperience.ibm.com/api//.
You can use the API base URL to initialize your wchtools client for scripting access to your hub. 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 the specific site context that is associated to 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 IBM provided shared host : https://myX.digitalexperience.ibm.com//.
Addressing sites for any domain through URL path
Calling WCH APIs in site context is not limited to using 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 WCH APIs in 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://myX.digitalexperience.ibm.com/api/< tenant-id >/dxsites/site1/
- Resource Base URL: https://myX.digitalexperience.ibm.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
Whether you map you content to a custom domain name, use the default domain, or the IBM provided shared host, you can access your site in a web browser and their static resources through the WCH APIs.