- 08 Oct 2024
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
Configure API Request
- Updated On 08 Oct 2024
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
This step enables you to request translated content from the custom translation tool through an API request.
Note:
The integration setup for the following topics uses Microsoft Azure as an example. Based on your requirements and the tool of your choice, setup the integration accordingly.
Use the following steps to configure the API request:
In the Configure Custom tool section, enter a Description (Optional) and select the Configuration type. Choose either Javascript or Request type.
Note:
Refer to Translation Tool Guidelines to learn about Javascript and Request parameters while configuring the steps for the custom translation tool.
Based on the Configuration type, perform the steps in the following accordion:Request
A. In the Method dropdown, select POST.
B. Enter the URL.
Example URL:https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=${attributes.targetLocale}&from=${attributes.sourceLocale}&textType=html // Here we can see that in order to access source and target locale we are using attributes.sourceLocale , attributes.targetLocale
C. Specify parameter details in the Headers field. Due to security reasons, click the Unhide icon and then add the Headers.
Here’s an example code for Headers:
{ "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY", "Ocp-Apim-Subscription-Region": "Global" }
Note: You must specify the Subscription-Key for the custom tool.Javascript
In the Script field, enter the Javascript code to request translated content from the custom translation tool.
Additional Configurations
In certain scenarios, based on the custom tool, additional configuration steps might be required to receive content. Use the + Add configuration icon to provide additional steps for the API request.
Similar to the steps highlighted above, enter the details in the Configuration 2 section: