This webservice is used to submit a hit to the property.
Resource information | |
---|---|
Authentication | Required |
HTTP Method | PUT |
Response | String |
https://property-api.mapaprop.com/property/hit
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 |
PUT <https://property-api.mapaprop.com/property/hit> Host: property-api.mapaprop.com Content-Type: text/plain; charset=utf-8 Content-Length: 0 Authorization: cfdjAsjfGwekhpICjkasgOIkaKMSGMAOkskOAIKTJEMUQskgalkslkgGJKJaMASJgflGKIEjaMAS
The JSON returned depends on whether the execution was successful or gave an error during the execution.
Object | Field | Type | Required | Description |
---|---|---|---|---|
Response Success | success | String | yes | A text indicating whether a post/put hit was made on the property |
Response Error | error | String | yes | A text indicating the exact error that occurred. |
Sample for implementation
`import axios from 'axios'; //imports
//credentials const propertyHitAccess = { baseURL: 'https://property-api.mapaprop.com/property/hit', token: 'cfdjAsjfGwekhpICjkasgOIkaKMSGMAOkskOAIKTJEMUQskgalkslkgGJKJaMASJgflGKIEjaMAS' }
//function const propertyHit = async (custId: any, propertyId:any , currentUrl:any ) => { try { const apiUrl = propertyHitAccess.baseURL; const headers = { 'Content-Type': 'text/plain', Authorization: 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)`