Search a Topic Title and Content - Fluid Topics - 3.8

Integrate Fluid Topics API

Product
Fluid Topics
FT_Version
3.8
Category
Technical Notes

It is possible to retrieve the title and the content of a specific topic within a map using the following web services:
Note: Clustering is not available for this web service.
  • /maps lists all maps stored on the Fluid Topics server.
  • /$MAP_ID allows to get metadata information for a specific map. The map ID is given with /maps.
  • /topics lists all topics within the given map.
  • /$TOPIC_ID allows to get the title and metadata information for a specific topic. The topic ID is given with /topics.
  • /content allows to retrieve the content – title excluded – of the given topic in TEXT/HTML format.

This can also be done by following the endpoints available in each web service output.

The following lines show an example of the Get a Topic Content web service implementation in Python.

#!/usr/bin/env python3
import requests
FT_SERVER_URL = 'https:// <host>/<tenantId>/'
                
#
MAPS_ENDPOINT = '/api/khub/maps'
                
# 
HEADERS = {'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']
...

After listing the topics, endpoints can be used to go deeper into the topics and retrieve more information.

As an example, the Get a Topic web service /$TOPIC_ID returns the following information for the topic "Introduction to Time Machines".

{
    "title": "Introduction to Time Machines",
    "id": "huzBwbbBW3WzTGHwshZIHg",
    "contentApiEndpoint": "/api/khub/maps/LyJjWU3GD5rsUR76jUvd6Q/topics/huzBwbbBW3WzTGHwshZIHg/content",
    "metadata": [
        {
            "key": "dita:ditavalPath",
            "label": "dita:ditavalPath",
            "values": [
                "ft:empty"
            ]
        },
        ...
    ]
}

Going deeper into the topic, the Get a Topic Content web service returns the following 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>