# Get All Ancestor Topics

## Overview
The Get All Ancestor Topics API retrieves the hierarchy from the root topic down to the given topic.

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

## Path parameters:

  - `portalID` (string, required)
    The ID of the portal being accessed.<br><br>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.<br><br>A topic ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

## Query parameters:

  - `$lang` (string)
    The language used for a resource. Resources available in different languages may differ from each other. 
If <code>$lang</code> 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.<br><br>*Note: The x-ext-integration-id and x-ext-interaction-id headers must always be provided together and cannot be supplied independently.<br><br>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.<br><br>*Note: The x-ext-integration-id and x-ext-interaction-id headers must always be provided together and cannot be supplied independently.<br><br>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 fields (application/json):

  - `topic` (array)

  - `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.

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

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

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

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

  - `topic.createdBy` (object)

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

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

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

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

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

  - `topic.createdDate` (string)

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

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

  - `topic.modifiedBy` (object)

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

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

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

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

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

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

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

  - `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.

  - `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.

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

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

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

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

  - `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.

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

  - `topic.link.rel` (string)
    Defines the relationship between a linked resource and the current object.For example: *self*, *prev*, *next* or an object name such as *'user'*, *'folder'* etc.

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

  - `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 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 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 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 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 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 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.

