Overview

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.

Prerequisites

To get started, you need:

Step-by-step

  1. 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.

  2. 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//.

    The resource base URL also addresses your JavaScript application that is hosted on your hub. 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 myX.digitalexperience.ibm.com that was assigned to you during onboarding is no longer available.

  3. 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

Expected outcome

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.

Join The Discussion

Your email address will not be published. Required fields are marked *