old-docs icon indicating copy to clipboard operation
old-docs copied to clipboard

Error : Resource does not exist"

Open NaeemKhan333 opened this issue 3 years ago • 6 comments

I am running this command on my terminal

curl -X POST   -H "Authorization: Key xyz"   -H "Content-Type: application/json"   -d '
  {
    "searches": [
      {
        "query": {
        "ranks": [
            {
            "annotation": {
                "data": {
                "image": {
                    "url": "https://samples.clarifai.com/metro-north.jpg"
                }
                }
            }
            }
        ]
        }
      }
    ]
  }' https://api.clarifai.com/v2/annnotations/searches

Facing this following error

{
    "status": {
        "code": 11101,
        "description": "Resource does not exist",
        "details": "Not Found"
    }
}

Please guide me about it. Thanks

NaeemKhan333 avatar Oct 21 '21 13:10 NaeemKhan333

Hi @NaeemKhan333 , what are you trying to do? Is this an example directly from the docs somewhere? I'm more familiar with the gRPC implementations but I can try to track down what is going on,

johntorcivia avatar Oct 21 '21 17:10 johntorcivia

@johntorcivia I have added the images in the images collection of clarifAI app using curl This is the link

https://docs.clarifai.com/api-guide/search/index-images-for-search Look in the Search by visual similarity section

You can use images to search through your collection. The API will return ranked results based on how similar the results are to the image you provided in your query.

Search by image URL

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "inputs": [
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/metro-north.jpg",
            "allow_duplicate_url": true
          }
        }
      },
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/wedding.jpg",
            "allow_duplicate_url": true
          }
        }
      }
    ]
  }'\
  https://api.clarifai.com/v2/inputs
# Use image's "base64" field to upload image from your local machine.

It adds the images in the Clarifai app.

Now I want to test this using the following command I want to send my image and want to get similar images from that collection which I created using the above command for adding the images.

https://docs.clarifai.com/api-guide/search/rank

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "searches": [
      {
        "query": {
        "ranks": [
            {
            "annotation": {
                "data": {
                "image": {
                    "url": "{YOUR_IMAGE_URL}"
                }
                }
            }
            }
        ]
        }
      }
    ]
  }'\
  https://api.clarifai.com/v2/annnotations/searches

It is giving me above error , can you help me out .

NaeemKhan333 avatar Oct 22 '21 09:10 NaeemKhan333

I have resolved the above issue using the command in the following link

Added the images in the App Data collection of Clarifai API using the following command

Link: https://docs.clarifai.com/api-guide/search/index-images-for-search

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "inputs": [
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/metro-north.jpg",
            "allow_duplicate_url": true
          }
        }
      },
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/wedding.jpg",
            "allow_duplicate_url": true
          }
        }
      }
    ]
  }'\
  https://api.clarifai.com/v2/inputs
# Use image's "base64" field to upload image from your local machine.

Find Similar Images from App Image Data Collection of ClarifAI API

Using the following link, you can send your image and get similar images from that collection which is created using the above command by adding your images.

Link: https://docs.clarifai.com/api-guide/search/search-1/rank

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "query": {
      "ands": [
        {
          "output":{
            "input":{
              "data": {
                "image": {
                  "url": "{YOUR_IMAGE_URL}"
                }
              }
            }
          }
        }
      ]
    }
  }'\
  https://api.clarifai.com/v2/searches

It works fine with Image's URL, now I want to use base64 methods for adding images into App collection and "Search Image from the collection by sending image" through my machine. Can you help me how I can use base64 method because I am facing an error

{"status":{"code":11102,"description":"Invalid request","details":"Malformed or invalid request"}}(base)

NaeemKhan333 avatar Oct 22 '21 12:10 NaeemKhan333

@johntorcivia How to send Base64 image to get the response of visual similarity from Image Data collection?

NaeemKhan333 avatar Oct 22 '21 12:10 NaeemKhan333

Hi @NaeemKhan333 . You should be able to use the command in the following way to send via base64 instead of URL:

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "query": {
      "ands": [
        {
          "output":{
            "input":{
              "data": {
                "image": {
                  "base64": "<base64 image>"
                }
              }
            }
          }
        }
      ]
    }
  }'\
  https://api.clarifai.com/v2/searches

johntorcivia avatar Oct 25 '21 15:10 johntorcivia

You can see an example of how "input" is constructed here, with base64 (even though it is a different command, the 'input' structure is the same across the entire API): https://docs.clarifai.com/api-guide/predict/images#via-bytes

johntorcivia avatar Oct 25 '21 15:10 johntorcivia