This webservice is used to submit a hit to the property.
| Resource information | |
|---|---|
| Authentication | Required (JWT con scope internal-portal) |
| HTTP Method | PUT |
| Response | String |
Resource URL
https://property-api.mapaprop.com/property/hit
Autenticacion
Se requiere un token JWT en el header Authorization: Bearer {access_token}. El token debe incluir el scope internal-portal; de lo contrario el servicio responde 403.
Parameters body request.
| Key | Type | Required | Description |
|---|---|---|---|
| custId | String | yes | the customer id identifier |
| propertyId | String | yes | the property id identifier |
| brandId | String | yes | brand or system sending data |
| origin | String | yes | originating portal sending the data |
| originUrlHit | String | yes | url of the property from which the data is sent |
| brandCountry | String | yes | country 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
El servicio devuelve un texto plano segun el resultado.
| Status | Cuerpo | Significado |
|---|---|---|
| 200 | Put hit. | Se incremento el contador de hits del dia para la propiedad. |
| 200 | Post first hit. | Se registro el primer hit de la propiedad. |
| 403 | { "message": "Scope required: internal-portal" } | El token no tiene el scope internal-portal. |
| 500 | Error parameters | Falta alguno de los parametros obligatorios del body. |
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)`