# Get Immediate Child Topics

## Overview
The Get Immediate Child Topics API retrieves details about a topic and it's immediate child topics. The $level attribute determines how deep the topic hierarchy should go, or how many child topics of a topic are returned in the response.

Endpoint: GET /portals/{portalID}/topics/{topicID}
Security: oAuthUser, oAuthOnBehalfOfUser, oAuthCustomer, oAuthOnBehalfOfCustomer, oAuthAnonymousCustomer, oAuthClient

## Description:

  - `Overview` ()
    The Get Immediate Child Topics API retrieves details about a topic and it's immediate child topics. 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` (unknown)
    oauth2 scopes: https://api.egain.cloud/auth/knowledge.portalmgr.read

  - `oAuthOnBehalfOfUser` (unknown)
    oauth2 scopes: https://api.egain.cloud/auth/knowledge.portalmgr.onbehalfof.read

  - `oAuthCustomer` (unknown)
    oauth2 scopes: https://api.egain.cloud/auth/knowledge.portalmgr.read

  - `oAuthOnBehalfOfCustomer` (unknown)
    oauth2 scopes: https://api.egain.cloud/auth/knowledge.portalmgr.onbehalfof.read

  - `oAuthAnonymousCustomer` (unknown)
    oauth2 scopes: https://api.egain.cloud/auth/knowledge.portalmgr.read

  - `oAuthClient` (unknown)
    oauth2 scopes: https://api.egain.cloud/auth/.default

## Path parameters:

  - `portalID` (string, 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.

  - `topicID` (string, required)
    The ID of a topic.A topic ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

## Query parameters:

  - `searchProfileId` (string)
    Search Profile ID

  - `level` (integer)
    Depth of the topic hierarchy to be returned in the response.

  - `$lang` (string)
    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.

  - `topicAdditionalAttributes` (array)
    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:
| Name | Description |
|  --- | --- |
| id | The ID of the topic. |
| name | The name of the topic. |
| articleCountInTopic | Number of articles in this topic. |
| articleCountInTopicTree | Number of articles in this topic and all sub-topics. |
| createdBy.id | The ID of the user that created the topic. |
| createdDate | The date when the topic was created. |
| departmentId | ID of the department for which this topic belongs to. |
| topicHomeArticleId | The ID of the article used as the home page of this topic. |
| modifiedBy.id | The ID of the user that last modified the topic. |
| modifiedDate | The date when the topic was last modified on. |
| childCount | Total number of children sub-topis below the current topic |
| subTopicIds | Array with the list of sub-topics |
| parentTopicId | ID of the parent topic. -1 if it is the root topic. |

  - `$customAdditionalAttributes` (string)

  - `$pagenum` (integer)
    Pagination parameter that specifies the page number of results to be returned. Used in conjunction with $pagesize.

  - `$pagesize` (integer)
    Pagination parameter that specifies the number of results per page. Used in conjunction with $pagenum.

## Header parameters:

  - `Accept-Language` (string, required)
    The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).

  - `x-ext-integration-id` (string)
    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.*

  - `x-egain-activity-id` (string)
    A unique numeric interaction identifier from eGain.

  - `x-ext-interaction-id` (string)
    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.*

## Response 200:

  - `200` (unknown)
    Success

## Response 200 fields (application/json):

  - `topicTree` (array)

  - `topicTree.topic` (object)
    This schema contains general information about the topic.

  - `topicTree.topic.id` (string, required)
    The alphanumeric ID of the topic.A topic ID is composed of a 4-letter prefix, followed by a dash and 4-15 digits.

  - `topicTree.topic.name` (any, required)
    The name of the topic.

  - `topicTree.topic.description` (string)
    A description of the topic.

  - `topicTree.topic.articleCountInTopic` (integer)
    Number of articles in this topic.

  - `topicTree.topic.articleCountInTopicTree` (integer)
    Number of articles in this topic and all sub-topics.

  - `topicTree.topic.createdBy` (object)

  - `topicTree.topic.createdBy.id` (string)
    The ID of the user that created this resource.

  - `topicTree.topic.createdBy.userName` (string)
    The resource creator's username.

  - `topicTree.topic.createdBy.firstName` (string)
    The resource creator's first name.

  - `topicTree.topic.createdBy.middleName` (string)
    The resource creator's middle name.

  - `topicTree.topic.createdBy.lastName` (string)
    The resource creator's last name.

  - `topicTree.topic.createdDate` (string)

  - `topicTree.topic.departmentId` (string)
    ID of the topic's department.
    Example: 1000001035

  - `topicTree.topic.imageUrl` (string)
    The URL of an image to be associated with the topic.

  - `topicTree.topic.modifiedBy` (object)

  - `topicTree.topic.modifiedBy.id` (string)
    The ID of the user that modified this resource.

  - `topicTree.topic.modifiedBy.userName` (string)
    The resource modifier's username.

  - `topicTree.topic.modifiedBy.firstName` (string)
    The resource modifier's first name.

  - `topicTree.topic.modifiedBy.middleName` (string)
    The resource modifier's middle name.

  - `topicTree.topic.modifiedBy.lastName` (string)
    The resource modifier's last name.

  - `topicTree.topic.modifiedDate` (string)
    The date on which the topic was last modified.

  - `topicTree.topic.childCount` (integer)
    Number of sub-topics below this topic.

  - `topicTree.topic.subTopicIds` (array)
    Array with the list of sub-topics. Valid IDs are composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

  - `topicTree.topic.parentTopicId` (string)
    ID of the parent topic. -1 if it is the root topic. Valid IDs are composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

  - `topicTree.topic.customAttributes` (array)
    Custom attributes for the Topic.

  - `topicTree.topic.customAttributes.name` (string)
    The custom attribute's name.

  - `topicTree.topic.customAttributes.value` (array)
    The custom attribute's values.

  - `topicTree.topic.customAttributes.type` (string)
    The custom attribute's type.
    Enum: "STRING", "INTEGER", "BOOLEAN", "DATETIME"

  - `topicTree.topic.topicHomeArticleId` (string)
    The ID of the article used as the home page of this topic. Valid IDs are composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

  - `topicTree.topic.link` (object)
    Defines the relationship between this resource and another object.

  - `topicTree.topic.link.rel` (string)
    Defines the relationship between a linked resource and the current object—for example a resource type name such as *article* or *topic* as defined by the API for that link.

  - `topicTree.topic.link.href` (string)
    The URL that specifies the link's destination.

  - `topicTree.topicTree` (array)

  - `paginationInfo` (object)

  - `paginationInfo.count` (integer, required)
    The total number of items.

  - `paginationInfo.pagenum` (integer, required)
    The page number requested. Page numbers start from 1.

  - `paginationInfo.pagesize` (integer, required)
    The number of objects requested per page. The maximum number of objects per page is 75.

  - `paginationInfo.link` (array)
    Can include the *prev* and *next* link.

## Response 204:

  - `204` (unknown)
    No Content

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `code` (string, required)
    A string that follows the pattern *{integer}-{integer}*.
The first *{integer}* is the http status code.  This code as a whole is unique.
* For example, error codes "400-101" and "404-101" are distinctly different.

  - `developerMessage` (string, required)
    A summary of the error.

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly messages are only supported by some APIs.
* The client must explicitly request UI friendly messages by passing the
*X-egain-error-message=yes*
 header.

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `code` (string, required)
    A string that follows the pattern *{integer}-{integer}*.
The first *{integer}* is the http status code.  This code as a whole is unique.
* For example, error codes "400-101" and "404-101" are distinctly different.

  - `developerMessage` (string, required)
    A summary of the error.

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly messages are only supported by some APIs.
* The client must explicitly request UI friendly messages by passing the
*X-egain-error-message=yes*
 header.

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `code` (string, required)
    A string that follows the pattern *{integer}-{integer}*.
The first *{integer}* is the http status code.  This code as a whole is unique.
* For example, error codes "400-101" and "404-101" are distinctly different.

  - `developerMessage` (string, required)
    A summary of the error.

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly messages are only supported by some APIs.
* The client must explicitly request UI friendly messages by passing the
*X-egain-error-message=yes*
 header.

## Response 404:

  - `404` (unknown)
    Not Found

## Response 404 fields (application/json):

  - `code` (string, required)
    A string that follows the pattern *{integer}-{integer}*.
The first *{integer}* is the http status code.  This code as a whole is unique.
* For example, error codes "400-101" and "404-101" are distinctly different.

  - `developerMessage` (string, required)
    A summary of the error.

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly messages are only supported by some APIs.
* The client must explicitly request UI friendly messages by passing the
*X-egain-error-message=yes*
 header.

## Response 406:

  - `406` (unknown)
    Not acceptable

## Response 406 fields (application/json):

  - `code` (string, required)
    A string that follows the pattern *{integer}-{integer}*.
The first *{integer}* is the http status code.  This code as a whole is unique.
* For example, error codes "400-101" and "404-101" are distinctly different.

  - `developerMessage` (string, required)
    A summary of the error.

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly messages are only supported by some APIs.
* The client must explicitly request UI friendly messages by passing the
*X-egain-error-message=yes*
 header.

## Response 500:

  - `500` (unknown)
    Internal server error

## Response 500 fields (application/json):

  - `code` (string, required)
    A string that follows the pattern *{integer}-{integer}*.
The first *{integer}* is the http status code.  This code as a whole is unique.
* For example, error codes "400-101" and "404-101" are distinctly different.

  - `developerMessage` (string, required)
    A summary of the error.

  - `details` (array)

  - `details.key` (string, required)

  - `details.value` (string)

  - `userMessage` (string)
    UI friendly messages are only supported by some APIs.
* The client must explicitly request UI friendly messages by passing the
*X-egain-error-message=yes*
 header.

## Response 200 examples:

  - `Get topic tree with $level value 0` (unknown)

  - `Get topic tree with $level value 1` (unknown)

  - `Topic tree with additional attributes with $level value 0` (unknown)

  - `Topic tree with custom attributes and $level value 0` (unknown)

## Response 400 examples:

  - `Required Attribute missing` (unknown)
    Required query parameter is missing.

  - `Unallowed attribute value` (unknown)
    One of the attributes has a value which is not allowed.

## Response 401 examples:

  - `Invalid Authorization` (unknown)
    Invalid or expired authorization. Generate a new authorization header and try again.

## Response 403 examples:

  - `Required Scope Missing` (unknown)
    User doesn't have the required scope to call this API. Refer to the API documentation regarding user scope assignment for more information.

## Response 404 examples:

  - `Resource Not Found` (unknown)
    Resource not found.

## Response 406 examples:

  - `Not Acceptable` (unknown)

## Response 500 examples:

  - `Internal Server Error` (unknown)

