Search code examples
azureapirestazure-cognitive-services

Getting 401/404 errors with Microsoft Azure Cognitive Services API


I followed the directions from https://learn.microsoft.com/en-us/rest/api/computervision/3.1/describeimage/describeimage but each time I fill in my endpoint, as https://[resource_name].cognitiveservices.azure.com or https://southcentralus.api.cognitive.microsot.com, I get a 404 or 401 error, respectively. I've checked to make sure the image url I specify works and loads fine withOUT a 404. Can anyone help?


Solution

  • You can use both hosts below to send request:

    https://<your service name>.cognitiveservices.azure.com
    https://<your service loaction>.api.cognitive.microsoft.com
    

    You can find all of then on Azure Portal=>Cognitive services=>your service =>Keys and Endpoint:

    enter image description here

    You should involve key as request header:Ocp-Apim-Subscription-Key to avoid 401 error just as below:

    enter image description here enter image description here

    Let me know if you have any more questions.