Endpoint to download a specific file based on its UID.
const url = 'base_url/public-api/v1/download/your_file_uid';
const apiKey = 'your_api_key';
fetch(url, {
method: 'GET',
headers: {
'api-key': apiKey,
},
})
.then((response) => {
if (!response.ok) {
if (response.status === 404) {
console.error('File not found.');
} else {
throw new Error(`Network error: ${response.status}`);
}
}
return response.json();
})
.then((data) => {
console.log(data);
})
.catch((error) => {
console.error('There was a problem with the Fetch request:', error);
});
const axios = require('axios');
const url = 'base_url/public-api/v1/download/your_file_uid';
const apiKey = 'your_api_key';
axios.get(url, {
headers: {
'api-key': apiKey,
},
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
if (error.response.status === 404) {
console.error('File not found.');
} else {
console.error('There was a problem with the Axios request:', error);
}
});