Error

{"error":{"code":401001,"message":"The request is not authorized because credentials are missing or invalid."}}

Solution

curl -X POST "https://my-swiss-n.cognitiveservices.azure.com/translator/text/v3.0/translate?to=fr"

-H "Ocp-Apim-Subscription-Key: xxx"

-H "Ocp-Apim-Subscription-Region: switzerlandnorth"

-H "Content-Type: application/json"

-d "[{'Text':'Hello'}]" -v