Get a topic's content - Fluid Topics - Latest

Integrate the Fluid Topics API

Category
Technical Notes
Audience
public
Version
Latest

It is possible to retrieve the content of topics in a map using the Get a topic's content web service:

/api/khub/maps/{mapId}/topics/{contentId}/content

Where:

  • /maps lists all maps stored on the Fluid Topics server.
  • /{mapId} retrieves metadata for a specific map. /api/khub/maps provides the map ID.
  • /topics lists all topics in the given map.
  • /{contentId} retrieves the title and metadata of a specific topic. /api/khub/maps/{mapId}/topics provides the content ID.
  • /content retrieves the content – title excluded – of the given topic in TEXT/HTML format.

Clustering is not available for this web service.

After listing the topics, it is possible to use endpoints to go deeper into the topics and retrieve more information.

For example, after getting the title of the topic Introduction to Time Machines, using the Get a topic's content web service returns the following additional information for this topic:

<div class="content-locale-en-US content-locale-en">
    <div id="intro_to_time_machines">
        <div class="body">
            <p class="p">Time travel has always been one of the biggest dreams of mankind! Our time machines
            allow you to travel in time easily and safely.</p>
        </div>
    </div>
</div>

The following lines show an example of a Python implementation of the Get a topic's content web service:

import requests

FT_SERVER_URL = 'https:// <host>/<serviceId>/<status>/'

MAPS_ENDPOINT = '/api/khub/maps'

HEADERS = {'FT-Authorization': 'Basic ...'}

def crawl_maps():
  URL = FT_SERVER_URL + MAPS_ENDPOINT
...              

def crawl_map(map_preview):
  URL = FT_SERVER_URL + map_preview['mapApiEndpoint']
...

def crawl_map_topics(map_details):
  URL = FT_SERVER_URL + map_details['topicsApiEndpoint']
...

def crawl_map_topic(topic_preview):
  URL = FT_SERVER_URL + topic_preview['contentApiEndpoint']
...