API access method - Fluid Topics - Latest

Fluid Topics Designer Guide

Category
Reference Guides
Audience
public
Version
Latest

The window.fluidtopics.FluidTopicsApi() method allows designers to use the Fluid Topics API in Custom components more easily.

The following example uses the GET method.

It calls the List bookmarks web service for the current user, and prints its response in the browser console:

FTAPI = await new window.fluidtopics.FluidTopicsApi();
FTAPI["Ft-Calling-App"] = "ft-page-designer";
bookmarks = await FTAPI.get(`/api/users/${user.profile.id}/bookmarks`);
console.log(bookmarks);

The following example uses the POST method.

It calls the Search maps web service, asking for maps matching the word "API" and in American English. Then, it prints its response in the browser console:

FTAPI = await new window.fluidtopics.FluidTopicsApi();
FTAPI["Ft-Calling-App"] = "ft-page-designer";
body = {
  "query": "API",
  "contentLocale": "en-US"
}
api_maps = await FTAPI.post(`/api/khub/maps/search`, body);
console.log(api_maps);