JavaScript SDK Integration
You need to be logged in to view your API credentials.
Integration Code
Learn how to use our vanilla JS SDK to easily interact with the API.
1. Importar o Script
Adicione o seguinte código no cabeçalho (<head>) ou antes de fechar a tag </body> do seu site:
<script src="https://hml.alugarcasas.com.br/media/com_imobiliaria/js/api.js"></script>
2. Inicializar a API
Crie uma instância informando a URL base do nosso sistema e o seu ID (Corretor ou Imobiliária).
const imobApi = new ImobiliariaAPI('https://hml.alugarcasas.com.br', '{{idcorretor:idimobiliaria}}');
3. Exemplos de Uso
Consultar Imóveis
imobApi.getImoveis({ cidade: 'São Paulo', limit: 10 })
.then(response => console.log('Imóveis:', response))
.catch(error => console.error('Erro:', error));
Consultar Detalhes do Imóvel
imobApi.getImovel(123)
.then(response => console.log('Detalhes:', response))
.catch(error => console.error('Erro:', error));
Consultar Cidades Disponíveis
imobApi.getCidades()
.then(response => console.log('Cidades:', response))
.catch(error => console.error('Erro:', error));
Enviar Proposta
const proposta = {
id_imovel: 123,
nome: 'Maria Silva',
email: '[email protected]',
telefone: '11988888888',
valor_proposta: 450000
};
imobApi.enviarProposta(proposta)
.then(response => console.log('Sucesso:', response))
.catch(error => console.error('Erro:', error));