Error Codes
API 錯誤回應使用 ErrorResponse。
提示
整合時請優先判斷 result_code,再依 validation_failed_responses 找出需要修正的欄位。
{
"message": "Validation failed.",
"result_code": "data_validation_failed",
"validation_failed_responses": [
{
"result_code": "field_is_required",
"message": "product_id is required.",
"property_name": "product_id"
}
],
"odata": null
}
Error Response Fields
| Field | Type | Required | Description |
|---|---|---|---|
message | string | No | 錯誤訊息。 |
result_code | enum | Yes | 結果代碼。 |
validation_failed_responses | array | No | 驗證錯誤清單,通常在 data_validation_failed 時有值。 |
odata | string | No | OData 錯誤內容。 |
Common Codes
| HTTP Status | Code | Meaning | How to Fix |
|---|---|---|---|
400 | data_validation_failed | 資料驗證失敗。 | 檢查必填、格式、數值範圍與 enum 值。 |
400 | o_data_failed | OData 驗證失敗。 | 檢查 $filter、$orderby 欄位與語法。 |
401 | token_validation_failed | private key 驗證失敗。 | 確認 x-api-key header 或重新申請 private key。 |
400 | data_not_exist | 資料不存在。 | 確認 product_id、訂單或組織資料是否正確。 |
400 | organization_disable | 組織停用。 | 聯繫客服確認組織狀態。 |
400 | credit_not_enough | 信用點數不足。 | 補足信用點數後重試。 |
400 | create_order_failed | 訂單建立失敗。 | 檢查產品狀態與 request body;若仍失敗,聯繫客服。 |
400 | conflicting_parameters | 參數衝突。 | 移除互斥欄位,例如同時帶入 link 與 username。 |
400 | below_minimum_quantity | 低於最低數量。 | 查詢產品 min 後重新送出。 |
400 | exceeds_maximum_quantity | 高於最高數量。 | 查詢產品 max 後重新送出。 |
400 | contact_customer_service | 需要聯繫客服。 | 提供 request payload、時間點與錯誤訊息給客服。 |
Full Result Code Enum
un_handle_exception
data_validation_failed
o_data_failed
token_validation_failed
data_not_exist
robot_validation_failed
not_allowed_enum_values
value_out_of_range
failed_to_upload_file
organization_disable
organization_id_incorrect
sequence_at_least_one_element
credit_not_enough
create_order_failed
string_length_out_of_range
field_is_required
invalid_email_format
invalid_format
file_type_must_be_temp
organization_not_belong_account
mobile_phone_only
phone_number_invalid
get_invoice_failed
invoice_provider_not_allow_invoice_receive_type
invoice_provider_not_allow_invoice_tax_type
create_invoice_failed
invoice_not_found
invoice_status_incorrect
issue_invoice_failed
void_invoice_failed
get_invoice_print_url_failed
credit_charge_payment_type_incorrect
credit_charge_status_incorrect
credit_charge_not_belong_organization
credit_charge_not_belong_account
batch_operation_failed
invalid_expiry_date
conflicting_parameters
below_minimum_quantity
exceeds_maximum_quantity
contact_customer_service
incorrect_service_id
incorrect_order_id
pay_uni_order_not_found