Creating glossary
- Print
- PDF
Creating glossary
- Print
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
Overview
This is an API to create a glossary. After creating glossary, the term data must be uploaded with the Upload Glossary File API.
Creating glossary
API URL
POST https://papago.apigw.ntruss.com/glossary/v1/create
Request header
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 name | Type | Requirement status | Type | Restrictions | Description |
---|---|---|---|---|---|
glossaryName | json | Yes | string | Up to 20 characters | Glossary name Example: "glossaryName":"Glossary1" |
description | json | No | string | Up to 50 characters | Glossary description Example: "description”:"Glossary1 용어집 설명 입니다." |
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 create():
baseurl = "https://papago.apigw.ntruss.com" #{OpenAPI endpoint}
url = "/glossary/v1/create"
access_key = "DonNfVLUKOMNnmXXXXXX" #{Main / Sub Account Access Key}
secret_key = "W5RyNUbIzOuUsEM8v8eqreMdSQZHMm9nfgXXXXXX" #{Main / Sub Account Secret Key}
timestamp = int(time.time() * 1000)
method = "POST"
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)
}
params = {
"glossaryName": "Glossary1",
"description": "Glossary1 용어집 설명 입니다."
}
response = requests.post(url=url, verify=True, headers=headers, json=params)
Response examples
{
"data": {
"glossaryKey": "c399cf78-781e-4353-89a6-cca8aaxxxxxx"
}
}
Was this article helpful?