Search code examples
jsonazure-logic-appsmicrosoft-custom-vision

Microsoft Custom Vision API: 404, Resource not found


I am trying to use Microsoft's Custom Vision API, but am running into nothing but 404 errors. How can I use the API?

I have tried copying and pasting and modifying the prediction sections of the Python and Javascript samples, such as the one found here: https://github.com/Azure-Samples/cognitive-services-node-sdk-samples/blob/master/Samples/customvision/customVisionImgClassify.js

Copying and pasting the prediction URL into my browser from the Perfomance page of Custom Vision, which is:

https://japaneast.api.cognitive.microsoft.com/customvision/v3.0/Prediction/999999999999999/classify/iterations/Iteration4/image

, yields the same 404 error:

{ "error":{ "statusCode": 404, "message": "Resource not found" }}

The closest I have gotten to successfully accessing the API is through an Azure Logic App, which uses an old version of Custom Vision:

/customvision/v1.0/Prediction/99999999999999999/image

This access method yields an "Unauthorized" error instead of a 404.

I tried modifying the JSON in the Azure Logic App to use the newer version of Custom Vision but am back to getting 404 errors. See below for the JSON (I replaced the keys and IDs with 9s):

"Predict_tags_from_image": {
                "inputs": {
                    "body": "@triggerBody()",
                    "headers": {
                        "Content-Type": "application/octet-stream",
                        "Prediction-Key": "9999999999999"
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['cognitiveservicescustomvision_1']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "https://japaneast.api.cognitive.microsoft.com/customvision/v3.0/Prediction/9999999999999/classify/iterations/Iteration4/image"
                },
                "runAfter": {
                    "Create_file": [
                        "Succeeded"
                    ]
                },
                "type": "ApiConnection"
            }

Thank you in advance for any help with this!


Solution

  • I tried creating a request with the url you provided and couldn't reproduce the 404 issue. It's showing 401, as I do not have your project id or prediction key. But when I try with my own project and prediction key, everything works and it's returning 200 OK.

    Screenshot1

    Screenshot2

    Could you please confirm the prediction url and prediction key header and try again?