Forums

Problem connecting to the Gameforge API

Hello.

When trying to connect to the gameforge API using the below request, the response is empty, hence getting the following error: simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0).

def _get_game_session(self, game_env_id, platform_game_id):
    response = self._request(
        method='post',
        url='https://gameforge.com/api/v1/auth/thin/sessions',
        delay=0,
        headers={'content-type': 'application/json'},
        json={'autoGameAccountCreation': False,
              'gameEnvironmentId': game_env_id,
              'gfLang': self.language,
              'identity': self.username,
              'locale': self.locale,
              'password': self.password,
              'platformGameId': platform_game_id})
    game_sess = response.json()
    if 'error' in game_sess:
        raise ValueError(game_sess['error'])
    return game_sess

When trying to get the HTTP status error using response.raise_for_status(), I get the following: requests.exceptions.HTTPError: 409 Client Error: Conflict for url: https://gameforge.com/api/v1/auth/thin/sessions

The 409 status code typically indicates a conflict with another resource on the server. It looks like the remote API is returning an error. Can somebody help?

NOTA BENE: I have a Hacker account. Not a free account.

EDIT: Trying with https://spark.gameforge.com/api/v1/auth/thin/sessions and I get a 403 status: 403 Client Error: Forbidden for url: https://spark.gameforge.com/api/v1/auth/sessions

We are not blocking you. You have to ask gameforge.