Translator keys do not work

Marina Marina 6 Reputation points
2021-01-04T11:29:19.31+00:00

Several times generated keys for translation service. It does not work in script that used 1 year ago.
Send my key to help support. It does not work either.

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
412 questions
{count} vote

1 answer

Sort by: Most helpful
  1. GiftA-MSFT 11,171 Reputation points
    2021-01-07T16:05:24.043+00:00

    Your subscription key is working just fine. Looks like you are specifying endpoint for global (non-regional) instead of 'westeurope' region. Your request should include the following headers:

    curl --location --request POST 'https://api-eur.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es' \
    --header 'Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxx' \
    --header 'Content-Type: application/json' \
    --header 'Ocp-Apim-Subscription-Region: westeurope' \
    --data-raw '[{'\''Text'\'':'\''Hello, what is your name?'\''}]'
    

    You can also use a tool like postman to confirm. Hope this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.