Hi @Carlos062 ! Ebenezer here from Engineering Support.
Getting this built may require some developer muscle.
I can provide a rough outline of how this would look like
document.getElementById('callApi1').addEventListener('click', function() {
callApi('YOUR_API_ENDPOINT_1');
});
document.getElementById('callApi2').addEventListener('click', function() {
callApi('YOUR_API_ENDPOINT_2');
function callApi(endpoint) {
// Make an API request to the specified endpoint
fetch(endpoint, {
method: 'GET', // Or 'POST', 'PUT', etc. depending on your API
headers: {
'Content-Type': 'application/json',
// Add any required headers here
},
// Add any required body parameters here for POST requests
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
// Handle successful API response here
console.log('API call successful');
})
.catch(error => {
// Handle errors here
console.error('There was a problem with the API request:', error);
});
Hope this helps!