Table of Contents

検索識別ターゲット | POST /v2/search

画像ターゲットを検索し、画像検索による識別インターフェース。

Action

POST /v2/search

認証

必要

Httpヘッダー

Content-Type : multipart/form-data

Authorization (API Key Token認証方式の場合のみ)

リクエストパラメータ

フィールド タイプ 必須 説明
image Multipart はい 画像内容のbase64エンコード文字列。JPGおよびPNG形式をサポート。
notracking String いいえ "false"はtrackingImageトラッキング画像を返す。"true"は検出されたtargetId属性のみ返し、トラッキング画像を返さない。WebARではデフォルトで付与推奨(リクエスト遅延低減)。

Token認証リクエスト例

curl -X POST -H "Authorization:xxx"  --form "image=@trackingImage.jpg;type=image/jpg"  --form appId=YOUR-APPID 
          https://<your-domain>-cn1.crs.easyar.com:8443/v2/search

署名認証リクエスト例

curl -X POST --form "image=@trackingImage;type=image/jpg" 
              --form apiKey=YOUR-APIKEY  --form appId=YOUR-APPID 
              --form timestamp=1514736000000 
              --form signature=xxx 
          https://<your-domain>-cn1.crs.easyar.com:8443/v2/search
重要
  • Client-end-URLを必ず使用(識別エントリーポイント)。httpsは8443ポート
  • httpヘッダーにConnection: Keep-Alive設定で繰り返し接続コストを最適化

レスポンスフィールド

フィールド 説明
statusCode ステータスコード 0 は認証成功。詳細はステータスコード参照
result エラーメッセージ、またはターゲット画像情報
timestamp レスポンス返却時のサーバー時間(Unixタイムスタンプ形式、ミリ秒単位)
result.targetId ターゲット画像の一意ID
result.trackingImage トラッキング画像のbase64エンコード文字列
result.name ターゲット名
result.size 認識画像の幅(単位 cm)。高さはアップロード画像から自動計算。認識画像サイズは仮想コンテンツのサイズに対応
result.meta base64エンコードされた追加情報(例:JSON文字列をbase64エンコードした文字列)
result.type 固定値 ImageTarget
result.active "1" 有効、"0" 無効

主要レスポンスコード

Response HTTPCODE Status Result
OK 200 0 result: { imageBody }
NO_RESULT 404 17 result: { message: "No result: there is no matching." }
NO_TARGET 500 18 result: { message: "Target not found: there is a matching but no target, please report this issue: IMAGE-UUID" }
TIMEOUT 408 19 result: { message: "Request timeout." }
OUT_OF_LIMIT 402 21 result: { message: "You have exceeded the limit of daily scanning." }
OUT_OF_QPS 200 21 result: { message: "Exceed your QPS limitation." }
RPC_ERROR 500 20 result: { message: "Error retrieving results." }
OTHER_ERROR 501 30 result: { message: "Other error occur: details" }

エラーコード

ステータスコードおよびエラーコード一覧を参照

リクエスト例

POST /search/ HTTP/1.1
Host:
Date: Mon, 1 Jan 2018 00:00:00 GMT
Content-Type: application/json
{
    "image":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
    "timestamp": 1514736000000,
    "appKey": "test_app_key",
    "signature": "89985e2420899196db5bdf16b3c2ed0922c0c221"
}

レスポンス例

  • ヒット時:

    HTTP/1.1 200 OK
    Content-Type: application/json
    {
        "statusCode": 0,
        "result": {
          "target": {
            "targetId":"e61db301-e80f-4025-b822-9a00eb48d8d2",
            "trackingImage":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
            "name": "easyar",
            "size": "5",
            "meta": "496fbbabc2b38ecs3460a...",
            "type": "ImageTarget",
            "modified":1514735000000
            "active":"1",
            "trackableRate": 0,
            "detectableRate": 0,
            "detectableDistinctiveness":0,
            "detectableFeatureCount": 0,
            "trackableDistinctiveness": 0,
            "trackableFeatureCount": 0,
            "trackableFeatureDistribution": 0,
            "trackablePatchContrast": 0,
            "trackablePatchAmbiguity": 0
          }
        },
        "timestamp": 1514736000000
    }

  • マッチングなし:

    HTTP/1.1 404 NOT FOUND
    Content-Type: application/json
    {
      "statusCode": 17,
      "result": {
        "message": "No result: there is no matching."
      }
    }