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 second POST API.

				
					curl -X POST https://api.beringlab.com/v1/text-translate \
-H "Content-Type: application/json" \
-d '{
    "source_language": "eng",
    "target_language": "kor",
    "source_content": "<w:body> <w:p> <w:pPr> <w:pStyle w:val=\"Heading1\"/> </w:pPr> <w:r><w:t>Introduction</w:t></w:r> </w:p> <w:p> <w:r><w:t xml:space=\"preserve\">My children love many nursery rhymes and childhood songs. </w:t></w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val=\"Heading1\"/> </w:pPr> <w:r><w:t>Favorites</w:t></w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val=\"Heading2\"/> </w:pPr> <w:r><w:t>Humpty Dumpty</w:t></w:r> </w:p> <w:p> <w:r><w:t xml:space=\"preserve\">None are more beloved than </w:t></w:r> <w:r> <w:rPr><w:b/></w:rPr> <w:t>Humpty Dumpty</w:t></w:r><w:r><w:t xml:space=\"preserve\">. </w:t> </w:r> </w:p> <w:p> <w:pPr> <w:spacing w:before=\"120\" w:after=\"120\"/> <w:ind w:left=\"720\" w:right=\"720\"/> <w:rPr> <w:sz w:val=\"18\"/> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:sz w:val=\"18\"/> </w:rPr> <w:t xml:space=\"preserve\">Humpty Dumpty sat on a wall. </w:t> </w:r> . . . </w:p>",
    "domain": "business",
    "subscription_id": [Your Subscription ID],
    "api_key": [Your API Key],
    "kind": "xml_docx"
}'
				
			

Example response

				
					"7244211692106813440"
				
			

POST 2

We retrieve the translated text by calling the second POST API.   

Example request

				
					curl -X POST https://api.beringlab.com/v1/text-translate/status/7244211692106813440 \
-H "Content-Type: application/json" \
-d '{
    "subscription_id": [Your Subscription ID],
    "api_key": [Your API Key]
}'
				
			

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

Example response

				
					{"status_code":0,"text":"<w:body><w:p><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr><w:r><w:t xml:space=\"preserve\">소개 </w:t></w:r></w:p><w:p><w:r><w:t xml:space=\"preserve\">제 아이들은 많은 동요와 어린 시절 노래를 좋아합니다. </w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr><w:r><w:t xml:space=\"preserve\">즐겨찾기 </w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val=\"Heading2\"/></w:pPr><w:r><w:t xml:space=\"preserve\">험티 덤프티 </w:t></w:r></w:p><w:p><w:r><w:rPr><w:b/></w:rPr><w:t xml:space=\"preserve\">험프티 덤프티보다 </w:t></w:r><w:r><w:t xml:space=\"preserve\">더 사랑받는 사람은 없다. </w:t></w:r></w:p><w:p><w:pPr><w:spacing w:before=\"120\" w:after=\"120\"/><w:ind w:left=\"720\" w:right=\"720\"/><w:rPr><w:sz w:val=\"18\"/></w:rPr></w:pPr><w:r><w:rPr><w:sz w:val=\"18\"/></w:rPr><w:t xml:space=\"preserve\">험프티 덤프티는 벽에 앉았다. </w:t></w:r>. . .</w:p>"}
				
			

Published