新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Search for matching image

回答済み
新規投稿

コメント

5件のコメント

  • Murtza

     Here is one possible solution, but there might be better alternative approaches. We provide a SHA-1 hash for every file in Box. You can use the search endpoint to query files by name and limit the results to files with an image extension. Then you can compare the SHA-1 of your image file with possible duplicates by looking at SHA-1 of the files in the search results.

    0
    コメントアクション Permalink
  • mmickelson

    Thanks Murtza,

    Although it isn't ideal, it could work. Maybe someday, the SHA1 could be an option for searching.

    0
    コメントアクション Permalink
  • mmickelson

    To add to your solution, it looks like I could include a size range. Since I would know the exact size of the file, I could use that to find only files with that specific size. After that, I could use the SHA1 to be sure. This will probably be the route I'll go.

    0
    コメントアクション Permalink
  • mmickelson

    I've been playing with the search API and may have found an issue, either with the documentation or the API.

    It appears that the query and file_extensions parameters are required, but that isn't indicated in the docs.

     

    DOESNT WORK:

    parameters:

    size_range=1207969,1207969

    returns:

    {
      "type": "error",
      "status": 400,
      "code": "bad_request",
      "context_info": {
        "errors": [
          {
            "reason": "invalid_parameter",
            "name": "to_search",
            "message": "Invalid value ''."
          }
        ]
      },
      "help_url": "http://developers.box.com/docs/#errors",
      "message": "Bad Request",
      "request_id": "***number removed for privacy***9590ab191ad129"
    }

    DOES WORK:

    parameters:

    query=IMG
    file_extensions=jpg
    size_range=1207969,1207969

    To get a valid response, I must have the query and file_extensions included when I use size_range. Even without the size_range, it requires the file_extensions parameter. Otherwise, I get 0 results.

     

    I hope this helps others too!

     

    0
    コメントアクション Permalink
  • Murtza

     Thanks for sharing your solution! I like your approach of using the file size range parameter to more efficiently return search results. 

     

    Thanks for catching this issue in our documentation. You are correct that a query parameter is required to use this endpoint, but the file extension parameter is optional. I updated our documentation to show the query string parameter is required. 

     

     

     

    0
    コメントアクション Permalink

サインインしてコメントを残してください。