Knowledge Class

Get information about trending articles in Experience Cloud sites.

ConnectApi

These methods are for Knowledge. All methods are static.

Get the top viewed articles for a topic.

41.0

41.0

No

public static ConnectApi.KnowledgeArticleVersionCollection getTopViewedArticlesForTopic(String communityId, String topicId, Integer maxResults)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

topicId

Type: String

ID of the topic.

maxResults

Type: Integer

The maximum number of articles returned for each topic ID. Values can be from 1 to 25. The default value is 5.

Type: ConnectApi.KnowledgeArticleVersionCollection

Get trending articles for an Experience Cloud site.

36.0

36.0

No

public static ConnectApi.KnowledgeArticleVersionCollection getTrendingArticles(String communityId, Integer maxResults)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

maxResults

Type: Integer

The maximum number of articles returned. Values can be from 0 to 25. Default is 5.

Type: ConnectApi.KnowledgeArticleVersionCollection

To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.

See Also

Get the trending articles for a topic in an Experience Cloud site.

36.0

36.0

No

public static ConnectApi.KnowledgeArticleVersionCollection getTrendingArticlesForTopic(String communityId, String topicId, Integer maxResults)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

topicId

Type: String

ID of the topic.

maxResults

Type: Integer

The maximum number of articles returned. Values can be from 0 to 25. Default is 5.

Type: ConnectApi.KnowledgeArticleVersionCollection

To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.

See Also

These test methods are for Knowledge. All methods are static.

For information about using these methods to test your ConnectApi code, see Testing ConnectApi Code.

Register a ConnectApi.KnowledgeVersionArticleCollection object to be returned when the matching ConnectApi.getTrendingArticles method is called in a test context. Use the method with the same parameters or you receive an exception.

36.0

public static Void setTestGetTrendingArticles(String communityId, Integer maxResults, ConnectApi.KnowledgeArticleVersionCollection result)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

maxResults

Type: Integer

The maximum number of articles returned. Values can be from 0 to 25. Default is 5.

result

Type: ConnectApi.KnowledgeArticleVersionCollection

Object containing test data.

Type: Void

See Also

Register a ConnectApi.KnowledgeVersionArticleCollection object to be returned when the matching ConnectApi.getTrendingArticlesForTopic method is called in a test context. Use the method with the same parameters or you receive an exception.

36.0

public static Void setTestGetTrendingArticlesForTopic(String communityId, String topicId, Integer maxResults, ConnectApi.KnowledgeArticleVersionCollection result)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

topicId

Type: String

ID of the topic.

maxResults

Type: Integer

The maximum number of articles returned. Values can be from 0 to 25. Default is 5.

result

Type: ConnectApi.KnowledgeArticleVersionCollection

Object containing test data.

Type: Void

See Also