question

KalinRudnicki-4727 avatar image
0 Votes"
KalinRudnicki-4727 asked KalinRudnicki-4727 answered

Unable to make my first translation API request

Whenever I try and make a POST request to:
https://api.cognitive.microsofttranslator.com/dictionary/lookup?api-version=3.0&from=en&to=[pl]
I get the error:
{"error":{"code":400003,"message":"One of the language specified is not valid."}}

I have done lots of searching around for a reason why this would not be working, and I can not figure out why for the life of me.
I am setting my 'Ocp-Apim-Subscription-Key' header, and I have also tried it with & without the 'Ocp-Apim-Subscription-Region' header.

Again, I am brand new to Azure, but I tried using a key that I got from "API Management services", as well as one I got by (creating a resource ?) following the link "Already using Azure? Try this service for free now" on the Translator page "https://azure.microsoft.com/en-us/services/cognitive-services/translator/".

If there is any other necessary information, I can provide it, but I think thats all I know.

azure-translator
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Im sorry, Im not sure where I copied that from. This is the error message:
{"error":{"code":401000,"message":"The request is not authorized because credentials are missing or invalid."}}

0 Votes 0 ·

1 Answer

KalinRudnicki-4727 avatar image
0 Votes"
KalinRudnicki-4727 answered

When I initially tried it, I tried it without the 'Ocp-Apim-Subscription-Region'. Now, with the key I generated from the "https://azure.microsoft.com/en-us/services/cognitive-services/translator/" link, WITHOUT including the region header, it now works!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.