<script type="text/javascript">

require([ "sbt/config", "sbt/lang", "sbt/dom", "sbt/json", "sbt/xml" ], 
    function(config,lang,dom,json,xml) {
    
    var options = { 
        method : "GET", 
        handleAs : "json"
    };
    
    var endpoint = config.findEndpoint("domino");
    var promise = endpoint.request("/DVDSample.nsf/a194d867bb19023c85257c66000c4034?ReadViewEntries&OutputFormat=JSON", options);

    var results = [];
    promise.then(
        function(data) {
            results.push({data : data || "<empty>"});
            //dom.setText("json", json.jsonBeanStringify(results));
            var res =  data.viewentry;
            for(var x in res){ 
            	console.log(" " + res[x].entrydata[1].text[0]);
            }
            
        }, 
        function(error) {
            results.push(error);
            dom.setText("json", json.jsonBeanStringify(results));
        }
    );    
    promise.response.then(
        function(response) {
            results.push(response);
            dom.setText("json", json.jsonBeanStringify(results));
            console.log("Response" + repsonse);
        }, function(response) {
            results.push(response);
            dom.setText("json", json.jsonBeanStringify(results));
        }
    );
    
});
</script>