def refresh(self, app, client_id, ttl):
        """Query the API to update this instance.

        :raise APIError: When Imgur responds with errors or unexpected data.

        :param sphinx.application.Sphinx app: Sphinx application object.
        :param str client_id: Imgur API client ID to use. https://api.imgur.com/oauth2
        :param int ttl: Number of seconds before this is considered out of date.
        """
        remaining = self.seconds_remaining(ttl)
        if remaining:
            app.debug2('Imgur ID %s still has %d seconds before needing refresh. Skipping.', self.imgur_id, remaining)
            return

        # Retrieve data.
        response = query_api(app, client_id, self.imgur_id, self.KIND == 'album')

        # Parse.
        try:
            return self._parse(response['data'])
        except KeyError as exc:
            raise APIError('unexpected JSON for {}: {}'.format(self.imgur_id, repr(exc)), app)