public List<GrouponResponse> getOffers(RequestBean request, int requiredNoOfOffers)
            throws InvalidRequestParametersException, CitysearchException {
        validate(request);
        Properties properties = PropertiesLoader.getAPIProperties();
        StringBuilder urlStringBuilder = new StringBuilder(
                properties.getProperty(GROUPON_URL_PROPERTY));
        urlStringBuilder.append(getGrouponQueryString(request));

        String apiKey = properties.getProperty(GROUPON_API_KEY_PROPERTY);
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-GrouponToken", apiKey);

        log.info("GrouponProxy.getOffers: Query: " + urlStringBuilder.toString());
        Document grouponResponse = null;
        try {
            grouponResponse = getAPIResponse(urlStringBuilder.toString(), headers);
            log.info("GrouponProxy.getOffers: successful response");
        } catch (InvalidHttpResponseException ihe) {
            throw new CitysearchException(this.getClass().getName(), "getOffers", ihe);
        }
        if (grouponResponse != null && grouponResponse.hasRootElement()) {
            Element rootElement = grouponResponse.getRootElement();
            String code = rootElement.getAttributeValue("code");
            String message = rootElement.getAttributeValue("message");
            if (code != null && code.equals("0") && message != null
                    && message.equalsIgnoreCase("OK")) {
                return parse(rootElement, requiredNoOfOffers);
            }
        }
        return null;
    }