용어집 개요

Prev Next

개요

Papago Text Translation, Papago Doc Translation 사용 시 번역의 일관성 유지에 도움을 주는 용어집(Glossary) 기능을 제공합니다.
용어집은 콘솔 화면 또는 API로 관리할 수 있으며, 아래에서는 용어집 API 이용 가이드를 안내드립니다.
콘솔 이용 방법은 용어집 사용자 가이드를 참고 부탁드립니다.

공통설정

API URL

https://papago.apigw.gov-ntruss.com/glossary/v1

요청 헤더

헤더 명 설명
x-ncp-apigw-timestamp 1970 년 1 월 1 일 00:00:00 협정 세계시(UTC)부터의 경과 시간을 밀리초(Millisecond)로 나타낸 것
API Gateway 서버와 시간차가 5 분 이상 나는 경우 유효하지 않은 요청으로 간주
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 네이버 클라우드 플랫폼 포털에서 발급받은 Access Key ID값
x-ncp-iam-access-key:{Main Account Access Key}
x-ncp-apigw-signature-v2 Access Key ID 값 과 Secret Key 로 암호화한 서명
x-ncp-apigw-signature-v2:{API Gateway Signature}

NAVER Cloud Platform 인증키 및 Signature 생성 가이드 바로가기
다음은 Java에서 'x-ncp-apigw-signature-v2'를 생성하는 예제입니다.
자세한 사항은 아래 문서를 참조해주시기 바랍니다.

public String makeSignature() {
    String space = " ";                      // one space
    String newLine = "\n";                   // new line
    String method = "POST";                  // method
    String url = "/glossary/v1";             // url (include query string)
    String timestamp = "{timestamp}";        // current timestamp (epoch)
    String accessKey = "{accessKey}"         // access key id (from portal or sub account)
    String secretKey = "{secretKey}";
    String algorithm = "HmacSHA256";
 
    String message = new StringBuilder()
        .append(method)
        .append(space)
        .append(url)
        .append(newLine)
        .append(timestamp)
        .append(newLine)
        .append(accessKey)
        .toString();
  
    try{
        SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"),  algorithm);
        Mac mac = Mac.getInstance(algorithm);
        mac.init(signingKey);
  
        byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8"));
        return org.apache.commons.codec.binary.Base64.encodeBase64String(rawHmac);
    } catch (InvalidKeyException | NoSuchAlgorithmException e) {
        throw new RuntimeException("make Signature failed");
    }  
}

API 제공 기능