Cloud recognition APIs エラーコード説明
レスポンス形式
すべての API response は統一された JSON 形式を使用します。以下は例です。
{
"statusCode": 422,
"reuslt": "The image or meta exceeds its maximum permitted size",
"timestamp": 1514736000000,
"appKey": "test_app_key"
}
| Field | Type | 説明 |
|---|---|---|
| statusCode | integer | Business status code。0 は成功、non-0 はエラーを示します |
| result | string | 返される内容。status code が 0 の場合は target image object 構造を response し、それ以外の場合は error message を返します |
| timestamp | long | Server Unix timestamp (ミリ秒単位) |
重要
statusCode == 0 の場合のみ、result に response content が含まれます。他の状態では result は error message を返します。
Error code 分類
HTTP status code 説明
| HTTP status code | 説明 |
|---|---|
| 200 | Request 成功。business errors を含む場合があります |
| 400 | Request parameter error |
| 401 | APIKey authentication failed |
| 403 | Permission 不足または resource アクセス禁止 |
| 404 | 要求された URL interface Path が存在しません |
| 500 | Server internal error |
| 501 | Application exception captured。data error の可能性があります |
| 502 | Server unavailable。customer service に連絡してください |
注記
Business errors は通常 HTTP 200 responses で返され、具体的な error type は statusCode field で識別されます。
Business status code 一覧
| Status Code | Message |
|---|---|
| 0 | ok |
| 1 | invalid appId (appKey) |
| 2 | invalid signature |
| 3 | invalid date |
| 4 | appId (appKey) not exist |
| 6 | invalid token |
| 6 | invalid appkey token |
| 7 | non-sdk client for dau databases |
| 8 | Dau databases are not compatible with sense-4.6+ any more. |
| 404 | Target not found |
| 414 | Parameter required not exists or not correct |
| 422 | The image or meta exceeds its maximum permitted size |
| 417 | fail to add image |
| 419 | Cannot update target in database because similar target exists. |
| 420 | Target delete failed |
| 424 | Target enable error |
| 403 | Target already exists |
| 426 | Judge exceeds maxium candidates |
| 427 | Image not correct |
よくあるエラーシナリオ
応答なしの timeout
- Request Timeout: ネットワークが比較的遅いです。client のネットワーク環境を確認することを推奨します
Authentication 関連エラー
- Http 401 Unauthorized: APIKey authentication failed。appId/appKey が正しいか確認してください
- Status code 401: application key が無効、または application が存在しません。application configuration を確認してください
Parameter errors
- 400 Bad Request: request parameter 形式エラー
- Status code 414: 必須 parameters が欠落している、または parameter values が要件を満たしていません
Resource operation errors
- Status code 404: 照会された target resource が存在しません
- Status code 403: target はすでに存在し、重複作成できません
- Status code 417/420/424: add、delete、update operation に失敗しました
File 関連エラー
- Status code 422: アップロードされた file size が制限を超えています
- Status code 427: image format がサポートされていない、または file が破損しています
System errors
- Http 500 Internal Server Error: server internal exception。website または sample でテストすることを推奨します
- Http 501 Exception: application exception captured。data error の可能性があります。website または sample でテストすることを推奨します
- Http 502 Server: service response error。server error の可能性があります。お問い合わせください
Best practice 提案
- Client 処理: HTTP status code のみに依存せず、
statusCodefield に基づいて business が成功したか判断することを推奨します - Error retry: 5xx errors では適切に retry し、4xx errors では request parameters を確認してください
- Log 記録: troubleshooting のため、完全な error response を記録することを推奨します
- Timeout 処理: 長時間待機を避けるため、合理的な request timeout を設定してください