Glossary terms endpoint

Glossary terms documentation

Fetch all glossary terms

glossary_terms(project_id[, params=None])
Parameters:
  • project_id (str) – ID of the project

  • params (dict) – Request parameters

Returns:

Collection of glossary terms

This endpoint uses cursor-based pagination.

Example:

glossary_terms = client.glossary_terms(PROJECT_ID, {
  "limit": 2,
  "cursor": "12345"
})

glossary_term = glossary_terms.items[0]
glossary_term.term # => "router"
glossary_terms.next_cursor # => "5489103"

Fetch a glossary term

glossary_term(project_id, glossary_term_id)
Parameters:
  • project_id (str) – ID of the project

  • glossary_term_id – ID of the term to fetch

Returns:

Glossary term model

Example:

glossary_term = client.glossary_term(PROJECT_ID, GLOSSARY_TERM_ID)

glossary_term.term # => "router"
glossary_term.description # => "A network device"
glossary_term.translatable # => True

Create glossary terms

create_glossary_terms(project_id, params)
Parameters:
  • project_id (str) – ID of the project

  • params (list or dict) – Glossary terms parameters

Returns:

Glossary terms collection

Example:

glossary_terms = client.create_glossary_terms(PROJECT_ID, [
    {
        "term": "python",
        "description": "sample desc",
        "caseSensitive": False,
        "forbidden": False,
        "translatable": True,
        "tags": ["term1"]
    },
    {
        "term": "code editor",
        "description": "",
        "caseSensitive": False,
        "forbidden": False,
        "translatable": True,
        "translations": [{
            "langId": 674,
            "translation": "éditeur de code",
            "description": (
                "Logiciel permettant d’écrire, modifier "
                "et organiser du code informatique."
            )
        }],
        "tags": ["term2"]
    },
])

term0 = glossary_terms.items[0]
term1 = glossary_terms.items[1]

term0.term # => "python"
term1.tags # => ["term2"]

Update glossary terms

update_glossary_terms(project_id, params)
Parameters:
  • project_id (str) – ID of the project

  • params (dict) – Glossary terms parameters

Returns:

Glossary terms collection

Example:

updated_terms = client.update_glossary_terms(PROJECT_ID, [
    {
        "id": GLOSSARY_TERM_ID,
        "description": "updated description",
        "caseSensitive": False
    }
])

term = updated_terms.items[0]

term.description # => "updated description"
term.caseSensitive # => False

Delete glossary terms

delete_glossary_terms(project_id, glossary_terms_ids)
Parameters:
  • project_id (str) – ID of the project

  • glossary_terms_ids (list) – List of the term IDs to delete

Returns:

Delete response

Rtype dict:

Example:

response = client.delete_glossary_terms(PROJECT_ID, [5489360, 5489361])

deleted_info = response['data']['deleted']

deleted_info['count'] # => 2
deleted_info['ids'][0] # => 5489360