GETTING STARTED

API REFERENCE

Your First API Request

This page is a Quick Start guide for testing the Bering API. It assumes you’ve already completed Access and Authentication. For detailed request parameters, please see our API Reference documentation.

Overview

 The Bering API consists of two RESTful services:

POST 1: to send text for translation into a target language.

POST 2: to retrieve the translated text.

POST 1

In the example below, we call the POST API for content from an XML document. The document is in English and we want to translate it to Korean with a legal context.

Example request

A job ID is returned, it will be used to get the translated text from the GET API.

				
					POST task-management/api/v1/external/mt/text-api-jobs HTTP/2
Host: https://api-v2.beringlab.com/
User-Agent: YourApp/1.2.3
Content-Length: 45
Content-Type: application/json

{
  "source_language": "eng",
  "target_language": "kor",
  "domain": "legal",
  "source_content": "<w:p>\n  <w:r>\n    <w:rPr>\n      <w:b/> <!-- 굵은 글씨 -->\n      <w:i/> <!-- 기울임 -->\n      <w:sz w:val=\"28\"/> <!-- 글자 크기 (14pt) -->\n      <w:color w:val=\"0000FF\"/> <!-- 파란색 -->\n    </w:rPr>\n    <w:t>This is a styled paragraph with bold, italicized text, a font size of 14pt, and blue color.</w:t>\n  </w:r>\n</w:p>",
  "subscription_id": "34526267111122",
  "api_key": "435436-asdg-3454654754-qnk-233",
  "kind": "xml_docx"
}
				
			

Example response

				
					{
    "123456789"
}
				
			

POST 2

We retrieve the translated text by calling the GET API.   

Example request

				
					GET /task-management/api/v1/external/mt/text-api-jobs/123456789 HTTP/2
Host: https://api-v2.beringlab.com/
User-Agent: YourApp/1.2.3
Content-Length: 45
Content-Type: application/json

{
  "api_key": "435436-asdg-3454654754-qnk-233",
  "subscription_id": "34526267111122"
}
				
			

In the example response below, the translated text is returned successfully.

Example response

				
					{
  "status_code": 0
  "text": "<w:p><w:r><w:rPr/><w:t xml:space=\"preserve\">이는 굵고 이탤릭체화된 텍스트, 글자 크기 14pt, 파란색으로 스타일링된 문단입니다. </w:t></w:r></w:p>"
}
				
			

Published