
## Fetch glossary objects by name

URL: https://docs.atlan.com/product/capabilities/build-apps/sdks/python/glossary/how-tos/retrieve-by-name

> Retrieve glossary objects by name using the Atlan Python SDK (pyatlan). Fetch glossaries, terms, and categories programmatically.

# AtlasBusiness Graph: Retrieve glossary objects by name

Use `AtlasBusiness Graph`, `AtlasGlossaryTerm`, and `AtlasGlossaryCategory` in the Atlan Python SDK to programmatically retrieve glossary objects by their qualified name.

Business Graph objects (terms, categories and even glossaries themselves) in Atlan have complicated `qualifiedName`s. This makes retrieving them using the `get()` operation less than ideal.

To address this, the SDKs provide helper methods to retrieve glossary objects based on their human-readable names.

## Retrieve glossary by name

To retrieve a glossary by its human-readable name:

### Java

```java showLineNumbers title="Retrieve glossary by name"
Business Graph glossary = Business Graph.findByName( // (1)
 client, // (2)
 "Concepts") // (3)
```

1. The `findByName()` helper method retrieves the glossary based on its human-readable name.
2. Because this operation will lookup the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.
3. You must provide the human-readable name of the glossary. The method will only include a bare minimum set of attributes about the glossary—you can request additional attributes by providing a list of them as an (optional) second parameter to this method.

### Python

```python showLineNumbers title="Retrieve category by name"
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
glossary = client.asset.find_glossary_by_name( # (1)
 name="Concepts", # (2)
 attributes=None) # (3)
```

1. The `asset.find_glossary_by_name()` method retrieves the glossary based on its human-readable name.
2. You must provide the human-readable name of the glossary.
3. The method will only include a bare minimum set of attributes about the glossary—you can request additional attributes by providing a list of them as the second parameter to this method.

### Kotlin

```kotlin showLineNumbers title="Retrieve glossary by name"
val glossary = Business Graph.findByName( // (1)
 client, // (2)
 "Concepts") // (3)
```

1. The `findByName()` helper method retrieves the glossary based on its human-readable name.
2. Because this operation will lookup the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.
3. You must provide the human-readable name of the glossary. The method will only include a bare minimum set of attributes about the glossary—you can request additional attributes by providing a list of them as an (optional) second parameter to this method.

### Raw REST API

```json showLineNumbers title="POST /api/meta/search/indexsearch"
{
 "dsl": { // (1)
 "from": 0,
 "size": 2,
 "query": {
 "bool": {
 "filter": [
 {
 "term": {
 "__state": {
 "value": "ACTIVE"
 }
 }
 },
 {
 "term": { // (2)
 "__typeName.keyword": {
 "value": "AtlasBusiness Graph"
 }
 }
 },
 {
 "term": { // (3)
 "name.keyword": {
 "value": "Concepts"
 }
 }
 }
 ]
 }
 },
 "track_total_hits": true
 },
 "suppressLogs": true,
 "showSearchScore": false,
 "excludeMeanings": false,
 "excludeClassifications": false
}
```

1. You actually need to run a search to retrieve glossary objects by name.
2. Filter the search by a specific type, in this example `AtlasBusiness Graph` is the name of the type in Atlan for glossaries.
3. You then must also filter by the name of the glossary you want to find. This example does an exact match against the provided `Concepts` value (case-sensitive).

## Retrieve category by name

To retrieve a category by its human-readable name:

### Java

```java showLineNumbers title="Retrieve category by name"
GlossaryCategory category = GlossaryCategory.findByName( // (1)
 client, // (2)
 "Finance", // (3)
 "Concepts"); // (4)
```

1. The `findByName()` helper method retrieves the category based on its human-readable name.
2. Because this operation will lookup the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.
3. You must provide the human-readable name of the category.
4. You must also provide the human-readable name of the glossary for that category. (A category with the same name can exist in different glossaries, but not in the same glossary.) The method will only include a bare minimum set of attributes about the category—you can request additional attributes by providing a list of them as an (optional) third parameter to this method.

### Python

```python showLineNumbers title="Retrieve category by name"
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
category = client.asset.find_category_by_name( # (1)
 name="Finance", # (2)
 glossary_name="Concepts", #(3)
 attributes=None) # (4)
```

1. The `asset.find_category_by_name()` method retrieves the category based on its human-readable name.
2. You must provide the human-readable name of the category.
3. You must also provide the human-readable name of the glossary for that category. (A category with the same name can exist in different glossaries, but not in the same glossary.)
4. The method will only include a bare minimum set of attributes about the category—you can request additional attributes by providing a list of them as the third parameter to this method.

### Kotlin

```kotlin showLineNumbers title="Retrieve category by name"
val category = GlossaryCategory.findByName( // (1)
 client, // (2)
 "Finance", // (3)
 "Concepts") // (4)
```

1. The `findByName()` helper method retrieves the category based on its human-readable name.
2. Because this operation will lookup the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.
3. You must provide the human-readable name of the category.
4. You must also provide the human-readable name of the glossary for that category. (A category with the same name can exist in different glossaries, but not in the same glossary.) The method will only include a bare minimum set of attributes about the category—you can request additional attributes by providing a list of them as an (optional) third parameter to this method.

### Raw REST API

:::warning[Requires multiple API operations]
To find a category by its name, using the name of the glossary it exists within (rather than the `qualifiedName` of the glossary), you must first find the glossary by name. (See above example.) Then use the returned `qualifiedName` of the glossary to run the search below for the category within that glossary.
:::
```json showLineNumbers title="POST /api/meta/search/indexsearch"
{
 "dsl": { // (1)
 "from": 0,
 "size": 2,
 "query": {
 "bool": {
 "filter": [
 {
 "term": {
 "__state": {
 "value": "ACTIVE"
 }
 }
 },
 {
 "term": { // (2)
 "__typeName.keyword": {
 "value": "AtlasGlossaryCategory"
 }
 }
 },
 {
 "term": { // (3)
 "name.keyword": {
 "value": "Finance"
 }
 }
 },
 {
 "term": { // (4)
 "__glossary": {
 "value": "LD5Tb30qbuYCZKsmFRpmS"
 }
 }
 }
 ]
 }
 },
 "track_total_hits": true
 },
 "suppressLogs": true,
 "showSearchScore": false,
 "excludeMeanings": false,
 "excludeClassifications": false
}
```

1. You actually need to run a search to retrieve category objects by name.
2. You should filter the search by a specific type, in this example `AtlasGlossaryCategory` is the name of the type in Atlan for categories.
3. You then must also filter by the name of the category you want to find. This example does an exact match against the provided `Finance` value (case-sensitive).
4. Finally, you should also filter the search for the specific glossary in which to find the category. (Since the same category name could exist in many glossaries.)

 :::warning[Requires qualifiedName of the glossary]
Note that this requires the `qualifiedName of the glossary, which therefore must first be known or found by an earlier search on glossaries.
 :::

## Retrieve term by name

To retrieve a term by its human-readable name:

### Java

```java showLineNumbers title="Retrieve term by name"
GlossaryTerm term = GlossaryTerm.findByName( // (1)
 client, // (2)
 "Revenue", // (3)
 "Concepts"); // (4)
```

1. The `findByName()` helper method retrieves the term based on its human-readable name.
2. Because this operation will lookup the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.
3. You must provide the human-readable name of the term.
4. You must also provide the human-readable name of the glossary for that term. (A term with the same name can exist in different glossaries, but not in the same glossary.) The method will only include a bare minimum set of attributes about the term—you can request additional attributes by providing a list of them as an (optional) third parameter to this method.

### Python

```python showLineNumbers title="Retrieve term by name"
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
term = client.asset.find_term_by_name( # (1)
 name="Revenue", # (2)
 glossary_name="Concepts", #(3)
 attributes=None) # (4)
```

1. The `asset.find_term_by_name()` method retrieves the term based on its human-readable name.
2. You must provide the human-readable name of the term.
3. You must also provide the human-readable name of the glossary for that term. (A term with the same name can exist in different glossaries, but not in the same glossary.)
4. The method will only include a bare minimum set of attributes about the term—you can request additional attributes by providing a list of them as the third parameter to this method.

### Kotlin

```kotlin showLineNumbers title="Retrieve term by name"
val term = GlossaryTerm.findByName( // (1)
 client, // (2)
 "Revenue", // (3)
 "Concepts") // (4)
```

1. The `findByName()` helper method retrieves the term based on its human-readable name.
2. Because this operation will lookup the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.
3. You must provide the human-readable name of the term.
4. You must also provide the human-readable name of the glossary for that term. (A term with the same name can exist in different glossaries, but not in the same glossary.) The method will only include a bare minimum set of attributes about the term—you can request additional attributes by providing a list of them as an (optional) third parameter to this method.

### Raw REST API

:::warning[Requires multiple API operations]
To find a term by its name, using the name of the glossary it exists within (rather than the `qualifiedName` of the glossary), you must first find the glossary by name. (See above example.) Then use the returned `qualifiedName` of the glossary to run the search below for the term within that glossary.
:::
```json showLineNumbers title="POST /api/meta/search/indexsearch"
{
 "dsl": { // (1)
 "from": 0,
 "size": 2,
 "query": {
 "bool": {
 "filter": [
 {
 "term": {
 "__state": {
 "value": "ACTIVE"
 }
 }
 },
 {
 "term": { // (2)
 "__typeName.keyword": {
 "value": "AtlasGlossaryTerm"
 }
 }
 },
 {
 "term": { // (3)
 "name.keyword": {
 "value": "Revenue"
 }
 }
 },
 {
 "term": { // (4)
 "__glossary": {
 "value": "LD5Tb30qbuYCZKsmFRpmS"
 }
 }
 }
 ]
 }
 },
 "track_total_hits": true
 },
 "suppressLogs": true,
 "showSearchScore": false,
 "excludeMeanings": false,
 "excludeClassifications": false
}
```

1. You actually need to run a search to retrieve term objects by name.
2. You should filter the search by a specific type, in this example `AtlasGlossaryTerm` is the name of the type in Atlan for terms.
3. You then must also filter by the name of the term you want to find. This example does an exact match against the provided `Revenue` value (case-sensitive).
4. Finally, you should also filter the search for the specific glossary in which to find the term. (Since the same term name could exist in many glossaries.)

 :::warning[Requires qualifiedName of the glossary]
Note that this requires the `qualifiedName of the glossary, which therefore must first be known or found by an earlier search on glossaries.
 :::

---
