Error Handling + Error Codes

Operators should send the error response in the following format and data:

Error Response + Example

{
	'status': 1,
	'error_id': 101,
	'error_code': 'INVALID_TOKEN',
	'error_message': "Invalid Token"
}
Object/Key in Response ObjectTypeDescription
statusInteger1 Indicates FAIL, 0 indicates SUCCESS,
error_idIntegerError ID
error_codeIntegerError code
error_messageStringOptional. 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.

IDCodeMessage
2001INVALID_%field_name%%field_name% is required.
2002INVALID_%field_name%%field_name% should not be null.
2003INVALID_%field_name%%field_name% should not be blank.
2004INVALID_%field_name%%field_name% should be at least %error_value% characters long.
2005INVALID_%field_name%%field_name% should not be more than %error_value% characters
2006INVALID_%field_name%String is invalid.
2007INVALID_%field_name%Email is invalid.
2008INVALID_%field_name%A valid integer is required.
2009INVALID_%field_name%The value should be equal or less than %error_value%.
2010INVALID_%field_name%The value should be equal or more than %error_value%.
2011INVALID_%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 this case, API caller is not sending the ‘transaction_id’ in POST data, RGS API would send an error message to the caller in the following format that is internal to game provider (Game Engine + RGS):

{
	"error": 1,
	"error_detail": {
		"id": 2001,
		"code": "INVALID_TRANSACTION_ID",
		"message": "Transactionid is required."
	}
}
Object/Key in Response ObjectTypeDescription
errorInteger1 Indicates ERROR, 0 indicates NO ERROR,
error_detailJSON ObjectIt has 3 keys id
idIntegerError ID
codeStringError code
messageStringOptional. Human readable error message



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

IDCodeMessage
2001INVALID_%field_name% will be interpreted as INVALID_TRANSACTION_ID“%field_name% is required.” will be interpreted as “Transaction id is required.”
2002INVALID_%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.”
2003INVALID_%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)

IDCodeMessage
2012INVALID_LOGIN_CREDENTIALSUnable to login with credentials provided.
2013INVALID_LOGIN_CREDENTIALSMust include username and password.
2014INVALID_LOGIN_CREDENTIALSUser does not belong to this website.
2015INVALID_API_KEYAPI Key is invalid
2016INVALID_SESSION_IDInvalid session ID
2017INVALID_PROVIDERInvalid provider
2018INVALID_GAME_TYPEInvalid game type
2019INVALID_PLATFORMInvalid platform
2020INVALID_AMOUNT_TYPEInvalid amount type
2021INVALID_PLAYER_IDInvalid player ID
2022INVALID_GAME_IDInvalid game ID.
2023INVALID_LANGUAGEInvalid language.
2024INVALID_USERNAMEInvalid username.
2025CURRENT_NEW_PASSWORD_SAMECurrent & new password should not be same.
2026INVALID_CURRENCYInvalid currency.
2027NEGATIVE_AMOUNT_VALUEAmount should be positive value.
2028INSUFFICINT_BALANCEInsufficient balance.
2029INVALID_STARTDATE_ENDDATEStart date should not be greater than end date.
2030INVALID_AMOUNT_VALUEAmount should be less than balance.
2031DUPLICATE_SESSION_IDDuplicate session ID.
2032OPERATOR_AUTHENTICATION_FAILAuthentication with operator failed.
2033CURRENCY_MISMATCHPlayer currency mismatch between operator and opus
2034ZERO_AMOUNT_VALUEAmount should be more than zero.
2035FALIED_TRANSTransaction not found or failed.
2036INVALID_FROM_DATEFrom date is greater than to date.
2037INVALID_TIME_INTERVALTime interval is more than the allowed one.
2038INVALID_MONETARY_TYPEInvalid monetary type.
2040INVALID_TRANSACTION_TYPEInvalid transaction type
Ex: it should be either withdraw or deposit
2062DUPLICATE_USERNAMEDuplicate username