Skip to content

Get All Topics

Request

Overview

The Get All Topics API retrieves the topic tree for a portal. The $level attribute determines how deep the topic hierarchy should go, or how many child topics of a topic are returned in the response.

Security
oAuthUser(Required scopes:
https://api.egain.cloud/auth/kno...
)
or oAuthCustomer(Required scopes:
https://api.egain.cloud/auth/kno...
)
or oAuthClient(Required scopes:
https://api.egain.cloud/auth/.de...
)
or oAuthOnBehalfOfUser(Required scopes:
https://api.egain.cloud/auth/kno...
)
or oAuthOnBehalfOfCustomer(Required scopes:
https://api.egain.cloud/auth/kno...
)
or oAuthAnonymousCustomer(Required scopes:
https://api.egain.cloud/auth/kno...
)
Path
portalIDstring, [ 7 .. 20 ] characters^[a-zA-Z0-9]{2,4}-\d{4,15}$required

The ID of the portal being accessed.

A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

Example:PROD-1000
Query
searchProfileIdstring, [ 1 .. 15 ] characters

Search Profile ID

Example:searchProfileId=959500000204621
levelinteger, (int64), [ -1 .. 20 ]

Depth of the topic hierarchy to be returned in the response.

Example:level=1
Examples:
AllLevels
All levels are returned
level=-1
Parent
Only parent topic is returned
level=0
Immediate
Parent and immediate children topics are returned
level=1
Grand Children
Immediate children and grand children are returned
level=2
$langstring(languageCode)

The language used for a resource. Resources available in different languages may differ from each other. If $lang is not passed, then the portal's default language is used.

Enum:"en-US""fr-FR""en-GB""es-ES""it-IT""nl-NL""da-DA""sv-SE""pt-PT""fi-FI"
Example:$lang=en-US
topicAdditionalAttributesArray of strings

The attributes of a topic to be returned in addition to the default list of attributes, listed below. Multiple additional attributes can be specified using a comma-separated list. Passing 'all' returns all attributes.

Default Attributes

These topic attributes are always returned:

NameDescription
idThe ID of the topic.
nameThe name of the topic.
articleCountInTopicNumber of articles in this topic.
articleCountInTopicTreeNumber of articles in this topic and all sub-topics.
createdBy.idThe ID of the user that created the topic.
createdDateThe date when the topic was created.
departmentIdID of the department for which this topic belongs to.
topicHomeArticleIdThe ID of the article used as the home page of this topic.
modifiedBy.idThe ID of the user that last modified the topic.
modifiedDateThe date when the topic was last modified on.
childCountTotal number of children sub-topis below the current topic
subTopicIdsArray with the list of sub-topics
parentTopicIdID of the parent topic. -1 if it is the root topic.
Items Enum:"description""createdBy.userName""createdBy.firstName""createdBy.lastName""createdBy.middleName""modifiedBy.userName""modifiedBy.firstName""modifiedBy.lastName""modifiedBy.middleName""imageUrl"
Examples:
Single
An additional attribute to be returned.
topicAdditionalAttributes=["modifiedBy.userName"]
Multiple
Additional attributes to be returned.
topicAdditionalAttributes=["description","imageUrl"]
All
All additional attributes to be returned.
topicAdditionalAttributes=["all"]
$customAdditionalAttributesstring, [ 1 .. 4000 ] characters^([a-zA-Z0-9_-]+)(?:,[a-zA-Z0-9_-]+)*$

One or more comma-separated names for custom attributes defined by the user to be returned.

Examples:
Single
A user-defined custom attribute.
$customAdditionalAttributes=country_name
Multiple
Multiple user-defined custom attributes.
$customAdditionalAttributes=internalScore,performance-rating_dept_923
$pagenuminteger, (int32), [ 1 .. 999 ]

Pagination parameter that specifies the page number of results to be returned. Used in conjunction with $pagesize.

Default:1
$pagesizeinteger, (int32), [ 1 .. 75 ]

Pagination parameter that specifies the number of results per page. Used in conjunction with $pagenum.

Default:10
Headers
Accept-Languagestringrequired

The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).

Enum:"en-US""es-ES""fr-FR""it-IT""de-DE""nl-NL""pt-BR""pt-PT""da-DK""ru-RU"
Example:en-US
x-ext-integration-idstring, <= 40 characters^[\w\W]+$

The unique numeric identifier for a tenant, used in self-service functionality as well as third-party integrations.

Note: The x-ext-integration-id and x-ext-interaction-id headers must always be provided together and cannot be supplied independently.

The x-egain-activity-id may be provided on its own, or it may be provided along with both x-ext-integration-id and x-ext-interaction-id.

Examples:
uuid
3155180e-0c13-43e9-9c38-e9045bcbf176
hex
00Dbn00000IxGnx
x-egain-activity-idstring, [ 4 .. 9 ] characters^[0-9]{4,9}$

A unique numeric interaction identifier from eGain.

Example:59237
x-ext-interaction-idstring, <= 40 characters^[\w\W]+$

A unique interaction identifier from other CRM applications.

Note: The x-ext-integration-id and x-ext-interaction-id headers must always be provided together and cannot be supplied independently.

The x-egain-activity-id may be provided on its own, or it may be provided along with both x-ext-integration-id and x-ext-interaction-id.

Examples:
uuid
3155180e-0c13-43e9-9c38-e9045bcbf176
hex
00Dbn00000IxGnx
GET
/portals/{portalID}/topics
curl -i -X GET \
  'https://api.egain.cloud/knowledge/portalmgr/v4/portals/PROD-1000/topics?searchProfileId=959500000204621&level=-1&%24lang=en-US&topicAdditionalAttributes=modifiedBy.userName&%24customAdditionalAttributes=country_name&%24pagenum=1&%24pagesize=10' \
  -H 'Accept-Language: en-US' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'x-egain-activity-id: 59237' \
  -H 'x-ext-integration-id: 3155180e-0c13-43e9-9c38-e9045bcbf176' \
  -H 'x-ext-interaction-id: 3155180e-0c13-43e9-9c38-e9045bcbf176'

Responses

Success

Bodyapplication/json
topicTreeArray of objects(Topic tree)
paginationInfoobject(PaginationInfo)
Response
{ "topicTree": [ {}, {}, {}, {}, {}, {}, {}, {} ] }