Top
Configure API Request
  • 08 Oct 2024
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Configure API Request

  • Dark
    Light
  • PDF

Article summary

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:

  1. 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:


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.