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을 설정하십시오