private void validateContract(final Contract contract)
            throws RegistrationException {
        final String id = getApiId(contract);

        try {
            GetRequest getRequest = new GetRequest(getIndexPrefixWithJoiner() + EsConstants.INDEX_APIS).id(id);
            GetResponse response = getClient().get(getRequest, RequestOptions.DEFAULT);

            if (!response.isExists()) {
                String apiId = contract.getApiId();
                String orgId = contract.getApiOrgId();
                throw new ApiNotFoundException(Messages.i18n.format("EsRegistry.ApiNotFoundInOrg", apiId, orgId));  //$NON-NLS-1$
            }
        } catch (IOException e) {
            throw new RegistrationException(Messages.i18n.format("EsRegistry.ErrorValidatingClient"), e); //$NON-NLS-1$
        }
    }
Ensures that the api referenced by the Contract at the head of
the iterator actually exists (is published).
@param contract the contract between client and api
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsRegistry.java