Error handling and error codes
An error response has the following format and data.
Error response example
{
"error": 1,
"error_id": 1001,
"error_code": "INVALID_API_KEY",
"error_message": "Invalid API key."
}
Object / Key in response object | Type | Description |
error | Integer | 1 Indicates FAIL, 0 indicates SUCCESS, |
error_id | Integer | Error ID |
error_code | String | Error Code |
error_message | String | Optional. Human readable error message. |
List of common errors codes and messages for all POST parameters
Below are common error codes for POST parameters. These will validate if any required POST parameter is missing, if it is null, length and size of the parameters etc. Same error code can be used for more than one POST parameter.
Common ID | Code | Message |
2001 | INVALID_%field_name% | %field_name% is required |
2002 | INVALID_%field_name% | %field_name% should not be null |
2003 | INVALID_%field_name% | %field_name% should not be blank |
2004 | INVALID_%field_name% | %field_name% should be at least %error_value% characters long. |
2005 | INVALID_%field_name% | %field_name% should not be more than %error_value% characters. |
2006 | INVALID_%field_name% | String is invalid |
2007 | INVALID_%field_name% | Email is invalid |
2008 | INVALID_%field_name% | A valid integer is required |
2009 | INVALID_%field_name% | The value should be equal or less than %error_value% |
2010 | INVALID_%field_name% | The value should be equal or more than %error_value% |
2011 | INVALID_%field_name% | Too large string value |
In the above table %field_name% can be any expected parameter that must be sent in the POST data. For example, let us take below POST data.
{
"api_key": "1pghjl4v5apt2bks",
"username": "test_user",
"password": "test1234",
"transaction_id": 1234
}
In case, API caller is not sending the transaction_id in POST data, RGS API would send below error message to the caller.
{
"error": 1,
"error_detail": {
"id": 2001,
"code": "INVALID_TRANSACTION_ID",
"message": "Transactionid is required."
}
}
error ‘code’ would be ‘INVALID_’ followed by missing parameter name in capitals i.e. ‘INVALID_TRANSACTION_ID’ and ‘message’ would be ‘parameter name without underscore, words separated by space’ and followed by ‘is required.’ i.e. ‘Transaction id is required’.
When ‘transaction_id’ parameter is missing in POST Data | ||||
id | Code Interpretation | Message Sample Value | ||
2001 | INVALID_%field_name% will be interpreted as INVALID_TRANSACTION_ID | “%field_name% is required.” will be interpreted as “Transaction id is required.” | ||
2002 | INVALID_%field_name% will be interpreted as INVALID_TRANSACTION_ID | “%field_name% should not be null.” will be interpreted as “Transaction id should not be null.” | ||
2003 | INVALID_%field_name% will be interpreted as INVALID_TRANSACTION_ID | “%field_name% should not be blank.” will be interpreted as “Transaction id should not be blank.” |
Same is the case with all the POST parameters that fall into the above validation criteria from id 2001 to 2011.
List of Error codes and messages (Excluding common code and message)
ID | Code | Message |
2016 | NVALID_SESSION_ID | Invalid session ID. |
2017 | INVALID_PROVIDER | Invalid provider. |
2018 | NVALID_GAME_TYPE | Invalid game type. |
2019 | INVALID_PLATFORM | Invalid platform. |
2020 | INVALID_AMOUNT_TYPE | Invalid amount type. |
2021 | INVALID_PLAYER_ID | Invalid player ID. |
2022 | INVALID_GAME_ID | Invalid game ID. |
2023 | INVALID_LANGUAGE | Invalid language |
2027 | NEGATIVE_AMOUNT_VALUE | Amount should be positive value. |
2028 | INSUFFICINT_BALANCE | Insufficient balance. |
2029 | INVALID_STARTDATE_ENDDATE | Start date should not be greater than end date. |
2030 | INVALID_AMOUNT_VALUE | Amount should be less than balance. |
2031 | DUPLICATE_SESSION_ID | Duplicate session ID. |
2032 | OPERATOR_AUTHENTICATION_FAIL | Authentication with operator failed. |
2033 | CURRENCY_MISMATCH | Player currency mismatch between operator and opus. |
2035 | FALIED_TRANS | Transaction not found or failed. |
2037 | INVALID_TIME_INTERVAL | Time interval is more than the allowed one. |
2041 | DUPLICATE_TRANSACTION_ID | Duplicate transaction ID. |
2042 | DUPLICATE_PROMO_BONUS_ID | Duplicate promo bonus ID. |
2049 | INVALID_CURRENCY_COUNT | Currency count should match with player count |
2053 | INVALID_COIN_VALUE | Invalid coin values |
3003 | EXTERNAL_GATEWAY_FAULT | Invalid JSON response from operator. |