Skip to content
Franco Mussopower pages
Code snippet

Retrieve multiple full size images using top

Copy it with the button on the code. For the why and the walkthrough, see “How to retrieve Image columns using Power Pages’ Portal Web API”.

Retrieve multiple full size images using topJavaScript
webapi.safeAjax({
    type: "GET",
    url: "/_api/msevtmgt_events?$select=msevtmgt_eventid&$filter=px3_heroimage_url ne null&$orderby=px3_heroimage_timestamp desc",
    contentType:"application/json",
    success: function(res) {
        $( res.value ).each(function( index ) {
                webapi.safeAjax({
                    type: "GET",
                    url: "/_api/msevtmgt_events(" + res.value[index].msevtmgt_eventid +")/px3_heroimage?size=full",
                    contentType:"application/json",
                    success: function(res) {
                        $('#main').append('<img class="img-responsive" src="data:image/png;base64,' + res.value + '">');
                    },
                    error: function(xhr, status, error){
                        $('body').append('<img class="img-responsive" src="/artwork-not-found.svg">');
                        var errorMessage = xhr.status + ': ' + xhr.statusText;
                        console.log(errorMessage);
                    }
                });
        });
    },
    error: function(xhr, status, error){
        var errorMessage = xhr.status + ': ' + xhr.statusText;
        console.log(errorMessage);
    }
});

Search

Book a discovery call

30 minutes. Bring your trickiest Power Pages problem — I’ll tell you honestly whether I’m the right fit.