Use multiple spaces

You can connect to multiple Contentful spaces for content data by creating a Contentful client for each space. To do this, you will need:

  1. Register the space/environment in the dashboard and give it a source ID. This source ID is an arbitrary key that you will use to refer to the environment in Canvas's web app as well as your enhancement code.

  2. Register the enhancer for the source ID with your enhancer code:

    const defaultClient = createClient({ space: '<YOUR CONTENTFUL SPACE ID>', accessToken: '<YOUR CONTENTFUL DELIVERY API KEY>', }); const namedSourceClient = createClient({ space: '<YOUR NAMED SOURCE SPACE ID>', accessToken: '<YOUR NAMED SOURCE DELIVERY API KEY>', }); const clientList = new ContentfulClientList({ client: defaultClient }); clientList.addClient({ source: 'namedSource', client: namedSourceClient });