function getExistingAttachments() {
webapi.safeAjax({
type: "GET",
url: "/_api/annotations?$select=annotationid,filename,mimetype&$filter=(_objectid_value eq {{ request.params.id }} and isdocument eq true)&$orderby=createdon desc",
contentType: "application/json",
success: function (data, textStatus, xhr) {
var results = data;
console.log(results);
for (var i = 0; i < results.value.length; i++) {
var result = results.value[i];
// Columns
var annotationid = result["annotationid"]; // Guid
var filename = result["filename"]; // Text
var mimetype = result["mimetype"]; // Text
// Run the generateThumbnail function, passing the note GUID, file name and mimetype as inputs
generateThumbnail(annotationid,filename,mimetype);
}
},
error: function (xhr, textStatus, errorThrown) {
console.log(xhr);
}
});
}