Downloading glossary files
    • PDF

    Downloading glossary files

    • PDF

    Article Summary

    Overview

    This API downloads registered glossaries. Glossaries are downloaded as zip files.

    Downloading glossary files

    API URL

    POST https://papago.apigw.ntruss.com/glossary/v1/{glossary-key}/download
    

    Request headers

    Request header information is required when calling the API.
    For a detailed guide to request headers, see the Glossary overview.

    x-ncp-apigw-timestamp:{Timestamp}
    x-ncp-iam-access-key:{Account Access Key}
    x-ncp-apigw-signature-v2:{API Gateway Signature}
    

    Request parameters

    Field nameTypeRequiredTypeDescription
    glossary-keyin pathYes-This is the unique key value of the glossary, which can be checked in the response value of the glossary creation API or in the Papago Translation console.
    Example: /glossary/v1/c399cf78-781e-4353-89a6-cca8aaxxxxxx/download

    Request examples

    import hashlib
    import hmac
    import base64
    import time
    import requests
    
    
    def make_signature(access_key, secret_key, timestamp, url, method):
        timestamp = str(timestamp)
        secret_key = bytes(secret_key, 'UTF-8')
    
        message = method + " " + url + "\n" + timestamp + "\n" + access_key
        message = bytes(message, 'UTF-8')
        signingKey = base64.b64encode(hmac.new(secret_key, message, digestmod=hashlib.sha256).digest())
        return signingKey.decode('UTF-8')
    
    
    def download():
        baseurl = "papago.apigw.ntruss.com" #{OpenAPI endpoint}
        url = "/glossary/v1/{}/download"
    
        access_key = "DonNfVLUKOMNnmXXXXXX" #{Main / Sub Account Access Key}
        secret_key = "W5RyNUbIzOuUsEM8v8eqreMdSQZHMm9nfgXXXXXX" #{Main / Sub Account Secret Key}
        timestamp = int(time.time() * 1000)
        method = "POST"
        glossary_key = "c399cf78-781e-4353-89a6-cca8aaxxxxxx"
        url = url.format(glossary_key) #{change {} in url to glossary-key.}
    
        signature = make_signature(access_key, secret_key, timestamp, url, method)
    
        url = baseurl + url
        headers = {
            "x-ncp-apigw-timestamp": str(timestamp),
            "x-ncp-iam-access-key": access_key,
            "x-ncp-apigw-signature-v2": str(signature)
        }
    
        response = requests.post(url=url, verify=True, headers=headers)
    

    Response parameters

    Field nameRequiredExamples
    Content-TypeYesapplication/zip
    Content-DispositionYesattachment; filename="papago_glossary_20231121163854511.zip"

    Response examples

    The body part of the response is binary and can be saved directly as a file.

    shell
    curl --location --request POST  'https://papago.beta-apigw.ntruss.com/glossary/v1/c26b6e45-437c-43ea-ae7f-22adb03f7eb0/download' -OJ
    

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.