Este webservice é utilizado para registrar uma visita (hit) em um imóvel.

Resource information
AuthenticationObrigatória (JWT com scope internal-portal)
HTTP MethodPUT
ResponseString

Resource URL

https://property-api.mapaprop.com/property/hit

Autenticação

É necessário um token JWT no header Authorization: Bearer {access_token}. O token deve incluir o scope internal-portal; caso contrário o serviço responde com 403.

Parameters body request.

KeyTypeRequiredDescription
custIdStringyesthe customer id identifier
propertyIdStringyesthe property id identifier
brandIdStringyesbrand or system sending data
originStringyesoriginating portal sending the data
originUrlHitStringyesurl of the property from which the data is sent
brandCountryStringyescountry code to store customer's local time

Sample code

PUT https://property-api.mapaprop.com/property/hit Host: property-api.mapaprop.com Content-Type: application/json Authorization: Bearer {access_token}


Response

O serviço retorna texto simples de acordo com o resultado.

StatusCorpoSignificado
200Put hit.O contador diário de hits do imóvel foi incrementado.
200Post first hit.O primeiro hit do imóvel foi registrado.
403{ "message": "Scope required: internal-portal" }O token não possui o scope internal-portal.
500Error parametersUm ou mais parâmetros obrigatórios do body estão ausentes.

Sample code

Sample for implementation

`import axios from 'axios'; //imports

//credentials const propertyHitAccess = { baseURL: 'https://property-api.mapaprop.com/property/hit', token: '{access_token}' }

//function const propertyHit = async (custId: any, propertyId:any , currentUrl:any ) => { try { const apiUrl = propertyHitAccess.baseURL; const headers = { 'Content-Type': 'application/json', Authorization: Bearer ${propertyHitAccess.token}, }; const data = { custId: custId, propertyId: propertyId, brandId: yourBrandName, origin: yourWebsite, originUrlHit: currentUrl, brandCountry: 'ar', //countryCode }; const response = await axios.put(apiUrl, data, { headers }); // console.log('Respuesta de la solicitud PUT:', response.data); } catch (error) { //console.error('Error al realizar la solicitud PUT:', error); } }; export { propertyHit };

//call the function propertyHit(response.data.customerId, response.data.propertyId, window.location.href)`