Errors and error handling

Fans United APIs raise an exception for many reasons, such as bad parameters, wrong or expired token, network unavailability. Each exception contains a descriptive message about the error and a standard HTTP response code to indicate the result of an API request. Generally: Codes starting with 2xx indicate success. Codes starting with 4xx indicate cases in which the error seems to have been caused by the client. Codes in the 5xx range indicate that server failed to fulfill a request. The following example response bodies can be returned in case of an error:

400 - Bad Request

The request was unacceptable, often due to missing, wrong or empty parameter.

{
	"error": {
		"code": 400,
		"message": "No client found with the given id",
		"status": "no_client_found"
	}
}

401 - Unauthorized

No valid token or api key provided. This response could be returned without a body.

{
	"code": 16,
	"message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
	"details": [
		{
			"@type": "type.googleapis.com/google.rpc.DebugInfo",
			"stackEntries": [],
			"detail": "service_control"
		}
	]
}

403 - Forbidden

Provided token doesn't have permissions to perform the request.

{
	"error": {
		"code": 403,
		"message": "User does not have permissions to set global roles",
		"status": "no_permissions_to_set_global_roles"
	}
}

404 - Not Found

The requested resource doesn't exist.

{
	"error": {
		"code": 404,
		"message": "No clients found for this user",
		"status": "no_clients_found_for_user"
	}
}

500 - Internal Server Error

Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

{
	"error": {
		"code": 500,
		"message": "Failed to delete user",
		"status": "failed_to_delete_user"
	}
}

A list of error statuses

This is a list of all statuses available per API.

Common

  • unknown_error
  • id_doesnt_exists
  • forbidden
  • internal_server_error
  • invalid_page
  • unauthorized
  • validation_error
  • invalid_sort_order
  • invalid_gender
  • invalid_url
  • service_invocation_error
  • client_id_required
  • invalid_client_id
  • predictor_feature_disabled

Football API

  • missing_competition_ids
  • invalid_competition_type
  • missing_team_ids
  • missing_player_ids
  • invalid_date_range
  • invalid_language
  • bad_date_format
  • next_match_not_found
  • previous_match_not_found
  • invalid_status
  • invalid_sort_field
  • invalid_date_range

ID Mapping API

  • invalid_resource_name
  • id_required
  • record_id_exists
  • existing_id_mismatch
  • invalid_resource_id
  • ids_limit_reached
  • invalid_id
  • invalid_id_provider

Profile API

  • invalid_ids
  • user_not_exists
  • api_key_not_linked
  • empty_profile_ids
  • invalid_name
  • invalid_avatar
  • invalid_country_name
  • client_exists
  • profile_already_exist
  • invalid_interests
  • country_not_exists
  • type_not_exists
  • invalid_profile_id
  • nickname_already_taken
  • profile_not_found_or_deleted
  • error_deleting_profile

Prediction API

  • invalid_prediction_data
  • invalid_game_data
  • game_not_found
  • predicton_not_found
  • invalid_game_status
  • predictions_cutoff
  • predictions_schedule_time
  • game_instance_id
  • invalid_game_instance_id
  • invalid_match_id
  • cannot_update_open_game
  • match_not_found
  • query_not_allowed
  • max_match_ids_allowed
  • game_not_finished
  • predictions_are_being_processed_now

Loyalty API

  • invalid_date
  • invalid_timespan
  • invalid_match_ids
  • template_not_found
  • activity_not_found
  • tiers_not_found
  • invalid_competitions_id
  • invalid_teams_ids
  • invalid_players_id
  • invalid_games_id
  • loyalty_disabled
  • invalid_action
  • invalid_json
  • invalid_user_id
  • invalid_content
  • invalid_campaign
  • invalid_market
  • invalid_type
  • invalid_success_rates
  • invalid_points
  • invalid_overall_percent
  • invalid_competition_percents
  • invalid_market_percents
  • invalid_team_percents
  • statistics_error
  • invalid_related_template_ids

Reporting API

  • invalid_group_by
  • invalid_date
  • competition_not_found
  • missing_entity_id