ManagedTopics Class

Access information about managed topics in a community. Create, delete, and reorder managed topics.

Namespace

ConnectApi

ManagedTopics Methods

The following are methods for ManagedTopics. All methods are static.

createManagedTopic(communityId, recordId, managedTopicType)

Creates a managed topic of a specific type for the specified community.

API Version

32.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopic createManagedTopic(String communityId, String recordId, ConnectApi.ManagedTopicType managedTopicType)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
recordId
Type: String
ID of the topic.
managedTopicType
Type: ConnectApi.ManagedTopicType
Specify the type of managed topic.
  • Featured—Topics that are featured, for example, on the community home page, but don’t provide overall navigation.
  • Navigational—Topics that display in a navigational menu in the community.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

You can create up to 25 managed topics per managedTopicType.

Return Value

Type: ConnectApi.ManagedTopic

Usage

Only community managers (users with the Create and Set Up Communities or Manage Communities permission) can create managed topics.

createManagedTopic(communityId, recordId, managedTopicType, parentId)

Creates a child managed topic for a community.

API Version

35.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopic createManagedTopic(String communityId, String recordId, ConnectApi.ManagedTopicType managedTopicType, String parentId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
recordId
Type: String
ID of the topic.
managedTopicType
Type: ConnectApi.ManagedTopicType
Specify Navigational for the type of managed topic to create a child managed topic.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

You can create up to 25 managed topics per managedTopicType.

parentId
Type: String
ID of the parent managed topic.

You can create up to eight levels (parent, direct children, their children, etc.) of managed topics and up to 10 children managed topics per managed topic.

Return Value

Type: ConnectApi.ManagedTopic

Usage

Only community managers (users with the Create and Set Up Communities or Manage Communities permission) can create managed topics.

createManagedTopicByName(communityId, name, managedTopicType)

Creates a managed topic of a specific type by name for the specified community.

API Version

32.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopic createManagedTopicByName(String communityId, String name, ConnectApi.ManagedTopicType managedTopicType)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
name
Type: String
Name of the topic.
managedTopicType
Type: ConnectApi.ManagedTopicType
Specify the type of managed topic.
  • Featured—Topics that are featured, for example, on the community home page, but don’t provide overall navigation.
  • Navigational—Topics that display in a navigational menu in the community.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

You can create up to 25 managed topics per managedTopicType.

Return Value

Type: ConnectApi.ManagedTopic

Usage

Only community managers (users with the Create and Set Up Communities or Manage Communities permission) can create managed topics.

createManagedTopicByName(communityId, name, managedTopicType, parentId)

Creates a child managed topic by name for a community.

API Version

35.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopic createManagedTopicByName(String communityId, String name, ConnectApi.ManagedTopicType managedTopicType, String parentId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
name
Type: String
Name of the topic.
managedTopicType
Type: ConnectApi.ManagedTopicType
Specify Navigational for the type of managed topic to create a child managed topic.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

You can create up to 25 managed topics per managedTopicType.

parentId
Type: String
ID of the parent managed topic.

You can create up to eight levels (parent, direct children, their children, etc.) of managed topics and up to 10 children managed topics per managed topic.

Return Value

Type: ConnectApi.ManagedTopic

Usage

Only community managers (users with the Create and Set Up Communities or Manage Communities permission) can create managed topics.

deleteManagedTopic(communityId, managedTopicId)

Deletes a managed topic from the specified community.

API Version

32.0

Requires Chatter

No

Signature

public static deleteManagedTopic(String communityId, String managedTopicId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicId
Type: String
ID of managed topic.

Return Value

Type: Void

Usage

Only community managers (users with the Create and Set Up Communities or Manage Communities permission) can delete managed topics.

getManagedTopic(communityId, managedTopicId)

Returns information about a managed topic in a community.

API Version

32.0

Available to Guest Users

32.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopic getManagedTopic(String communityId, String managedTopicId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicId
Type: String
ID of managed topic.

Return Value

Type: ConnectApi.ManagedTopic

getManagedTopic(communityId, managedTopicId, depth)

Returns information about a managed topic, including its parent and children managed topics, in a community.

API Version

35.0

Available to Guest Users

35.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopic getManagedTopic(String communityId, String managedTopicId, Integer depth)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicId
Type: String
ID of managed topic.
depth
Type: Integer
Specify an integer 1–8. If you specify 1, the children property of the ConnectApi.ManagedTopic output class is null. If you specify 2, the children property of the ConnectApi.ManagedTopic output class contains the direct children managed topics, if any, of the managed topic. If you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. If depth isn’t specified, it defaults to 1.

Return Value

Type: ConnectApi.ManagedTopic

getManagedTopics(communityId)

Returns the managed topics for the community.

API Version

32.0

Available to Guest Users

32.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopicCollection getManagedTopics(String communityId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.

Return Value

Type: ConnectApi.ManagedTopicCollection

getManagedTopics(communityId, managedTopicType)

Returns managed topics of a specified type for the community.

API Version

32.0

Available to Guest Users

32.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopicCollection getManagedTopics(String communityId, ConnectApi.ManagedTopicType managedTopicType)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicType
Type: ConnectApi.ManagedTopicType
Type of managed topic.
  • Featured—Topics that are featured, for example, on the community home page, but don’t provide overall navigation.
  • Navigational—Topics that display in a navigational menu in the community.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

Return Value

Type: ConnectApi.ManagedTopicCollection

getManagedTopics(communityId, managedTopicType, depth)

Returns managed topics of a specified type, including their parent and children managed topics, in a community.

API Version

35.0

Available to Guest Users

35.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopicCollection getManagedTopics(String communityId, ConnectApi.ManagedTopicType managedTopicType, Integer depth)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicType
Type: ConnectApi.ManagedTopicType
Type of managed topic.
  • Featured—Topics that are featured, for example, on the community home page, but don’t provide overall navigation.
  • Navigational—Topics that display in a navigational menu in the community.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

depth
Type: Integer
Specify an integer 1–8. If you specify 1, the children property of the ConnectApi.ManagedTopic output class is null. If you specify 2, the children property of the ConnectApi.ManagedTopic output class contains the direct children managed topics, if any, of the managed topic. If you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. If depth isn’t specified, it defaults to 1.

Return Value

Type: ConnectApi.ManagedTopicCollection

getManagedTopics(communityId, managedTopicType, recordId, depth)

Returns managed topics of a specified type, including their parent and children managed topics, that are associated with a given topic in a community.

API Version

35.0–37.0

Important

Important

In version 38.0 and later, use getManagedTopics(communityId, managedTopicType, recordIds, depth).

Available to Guest Users

35.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopicCollection getManagedTopics(String communityId, ConnectApi.ManagedTopicType managedTopicType, String recordId, Integer depth)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicType
Type: ConnectApi.ManagedTopicType
Type of managed topic.
  • Featured—Topics that are featured, for example, on the community home page, but don’t provide overall navigation.
  • Navigational—Topics that display in a navigational menu in the community.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

recordId
Type: String
ID of the topic associated with the managed topics.
depth
Type: Integer
Specify an integer 1–8. If you specify 1, the children property of the ConnectApi.ManagedTopic output class is null. If you specify 2, the children property of the ConnectApi.ManagedTopic output class contains the direct children managed topics, if any, of the managed topic. If you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. If depth isn’t specified, it defaults to 1.

Return Value

Type: ConnectApi.ManagedTopicCollection

getManagedTopics(communityId, managedTopicType, recordIds, depth)

Returns managed topics of a specified type, including their parent and children managed topics, that are associated with topics in a community.

API Version

38.0

Available to Guest Users

38.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopicCollection getManagedTopics(String communityId, ConnectApi.ManagedTopicType managedTopicType, List<String> recordIds, Integer depth)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicType
Type: ConnectApi.ManagedTopicType
Type of managed topic.
  • Featured—Topics that are featured, for example, on the community home page, but don’t provide overall navigation.
  • Navigational—Topics that display in a navigational menu in the community.

A topic can be associated with up to two managed topic types, so a topic can be both a Featured topic and a Navigational topic.

recordIds
Type: List<String>
A list of up to 100 topic IDs associated with the managed topics.

If you list more than 10 topic IDs, you can’t specify 2–8 for depth.

depth
Type: Integer
Specify an integer 1–8. If you specify 1, the children property of the ConnectApi.ManagedTopic output class is null. If you specify 2, the children property of the ConnectApi.ManagedTopic output class contains the direct children managed topics, if any, of the managed topic. If you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. If depth isn’t specified, it defaults to 1.

Return Value

Type: ConnectApi.ManagedTopicCollection

reorderManagedTopics(communityId, managedTopicPositionCollection)

Reorders the relative positions of managed topics in a community.

API Version

32.0

Requires Chatter

No

Signature

public static ConnectApi.ManagedTopicCollection reorderManagedTopics(String communityId, ConnectApi.ManagedTopicPositionCollectionInput managedTopicPositionCollection)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
managedTopicPositionCollection
Type: ConnectApi.ManagedTopicPositionCollectionInput
A collection of relative positions of managed topics. This collection can include Featured and Navigational managed topics and doesn’t have to include all managed topics.

Return Value

Type: ConnectApi.ManagedTopicCollection

Usage

Only community managers (users with the Create and Set Up Communities or Manage Communities permission) can reorder managed topics.

You can reorder parent managed topics or children managed topics with the same parent. If you don’t include all managed topics in the ConnectApi.ManagedTopicPositionCollectionInput, the managed topics are reordered by respecting the positions indicated in the ConnectApi.ManagedTopicPositionCollectionInput and then by pushing down any managed topics that aren’t included in the ConnectApi.ManagedTopicPositionCollectionInput to the next available position.

Example

If you have these managed topics:

Managed Topic Position
ManagedTopicA 0
ManagedTopicB 1
ManagedTopicC 2
ManagedTopicD 3
ManagedTopicE 4

And you reorder managed topics by including this information in ConnectApi.ManagedTopicPositionCollectionInput:

Managed Topic Position
ManagedTopicD 0
ManagedTopicE 2

The result is:

Managed Topic Position
ManagedTopicD 0
ManagedTopicA 1
ManagedTopicE 2
ManagedTopicB 3
ManagedTopicC 4