Publish New Content - Fluid Topics - 3.7 - Technical Notes

Develop Connectors with the Fluid Topics API

Product
Fluid Topics
FT_Version
3.7
Category
Technical Notes
language
English
audience
public

The following lines show how to publish documents to a Fluid Topics tenant:

from fluidtopics.connector import EditorialType, LoginAuthentication, Metadata, RemoteClient, StructuredDocument, Topic, UnstructuredDocument

# Client creation
authentication = LoginAuthentication("root@fluidtopics.com", "change_it")
client = RemoteClient("http://localhost:8080/myPortal", authentication, "external")

# Metadata creation
meta1 = Metadata("version", "4.2")
meta2 = Metadata("author", "John Doe")

# Topics creation
topic_A = Topic.create(topic_id="topic-id-a", title="Topic A")
topic_B = Topic.create(topic_id="topic-id-b", title="Topic B")

# Unstructured Document creation
ud = UnstructuredDocument.from_uri(
document_id="my-UD",
title="I am a UD",
locale="en-GB",
description="Description of a UD",
pretty_url="my-pretty-UD",
metadata=[meta1, meta2]
uri="/path/to/the/file/ud.pdf"
)

# Structured Document creation
book = StructuredDocument.create(
document_id="my-structured-document",
title="My Structured Document",
locale="en-US",
toc=[topic_A, topic_B],
editorial_type=EditorialType.BOOK
)

# Publish
client.publish(ud, book, publish_name="Uploaded from FT Python API")