The Azure AI Translator service has a new synchronous API in preview. The nice thing about this API is that it does not require any Azure Storage account to be set up to which you typically need to upload the files to be translated. Instead, you can just send the document to be translated directly to the API and you will get the translated document back.
infoYou can read more information about the synchronous API on the Get started with synchronous translation article.
In this post, I will show you how to use the synchronous Azure translation API in Node.js.
Calling the synchronous Azure translation API
To call the synchronous Azure translation API, you need to send a POST request to the https://{your-instance}.cognitiveservices.azure.com/translator/document:translate
endpoint with form data containing the document to be translated.
Here is an example of how you can call the synchronous Azure translation API in Node.js:
|
|
That’s it! You have now successfully called the synchronous Azure translation API in Node.js.