Search⌘ K
AI Features

Implementing Text Translation

Explore how to implement Azure Language Cognitive Services Translator using REST API calls. Learn to send text to multiple languages, set required headers, and handle JSON responses without an SDK.

Introduction to text translation using REST API

In this lesson, we’ll translate the text to multiple languages using a REST API call. As of now, there is no SDK available for the translator service and so we’ll be using the API call to the service.

When calling the Translator service via REST to translate the text data, we needs to make sure the following headers are included with each request:

Headers to include while making a text translation request

Header

Description

Ocp-Apim-Subscription-Key

This header specifies the subscription key of the translator resource.

Ocp-Apim-Subscription-Region

This header specifies the region of the translator resource.

Content-type

This header specified the type of data that you are passing with the request. It should have the value as application/json.

X-ClientTraceId

This header specifies a unique ID for each request.

Implementation

...