What will be the syntax to connect Microsoft Document Translator using HTTP request
1 Like
Hi
Hope the below steps would help you resolve this
- First create an HTTP Request activity in UiPath Studio by dragging and dropping it from the Activities panel.
- Then, you need to set the properties of the HTTP Request activity as follows:a. Method - Set this to “POST” since we will be sending data to the Microsoft Translator API.b. Endpoint - Set this to the URL of the Microsoft Translator API. For example, “https://api.cognitive.microsofttranslator.com/translate”.c. Headers - Add the required headers for the API call. This includes the “Content-Type” header, which should be set to “application/json”, and the “Ocp-Apim-Subscription-Key” header, which should be set to your API key.d. Body - Set the body of the request as a JSON object that includes the text to be translated, the source language, and the target language. For example:
{ "Text": "Hello, world!", "SourceLanguage": "en", "TargetLanguage": "fr" }
- Finally, you can send the HTTP request by calling the “Send” method of the HTTP Request activity.
Cheers @tushar.c2
1 Like