Getting Media
We set up a project called EC5 API Test. The project is public so anyone can perform a GET request to fetch its entries.
Here is the response of the following GET endpoint, to retrieve a project logo image: (Open in browser)
https://five.epicollect.net/api/export/media/ec5-api-test?type=photo&format=project_thumb&name=logo.jpg
Here is the response of the following GET endpoint, to retrieve an answer original image: (Open in browser)
https://five.epicollect.net/api/export/media/ec5-api-test?type=photo&format=entry_original&name=768bb179-fd2c-87b1-ec20-86a9acfdc87a_1493303895.jpg
var mediaEndpoint = 'https://five.epicollect.net/api/export/media/ec5-api-test?';
function _getEntries() {
window.setTimeout(function() {
$.ajax({
url: 'https://five.epicollect.net/api/export/entries/ec5-api-test',
type: 'GET',
contentType: 'application/vnd.api+json',
success: function(response) {
var entries = response.data.entries;
var images = [];
var filename;
$(response.data.entries).each(function(index, entry) {
filename = entry.photo;
_getMedia(mediaEndpoint + 'type=photo&format=entry_original&name=' + entry.photo)
});
},
error: function(xhr, status, error) {
console.log(xhr.responseText);
}
});
}, 1000);
}