Hi,
I know this is a javascript question and not an API question, but I cannot seem to figure this out.
When I retrieve the properties of a folder, how can I do this in an easy way.
This is what is returned by the API:
{"APIVersion":4,"auth":true,"contents":[{"childCount":15,"dataHash":null,"dataSize":null,"id":2000,"isContainer":true,"isFavorite":false,"isNotifySet":false,"isReadOnly":false,"isRootShare":false,"isShareable":false,"isShared":false,"isSubscribed":null,"mimeType":null,"modifyDate":"2014-01-10T09:02:56Z","modifyUserName":"Admin","name":"Enterprise","numComments":0,"originDataID":0,"originSubtype":null,"originTypeName":null,"parentID":-1,"permissions":-2130706433,"rootType":"EWS","sharedFolder":0,"subtype":141,"thumbnailEnabled":false,"versionNum":0}],"count":1,"cstoken":"VF8XzjGbM9SQGolo5qSWgG35HqTT%2FMcYsRWkUGwz2JM%3D","ok":true,"serverDate":"2014-02-07T19:32:54Z","userID":127621}
Currently I do it like this:
function showFileInfo() {
var fileID = document.getElementById("fileID").value;
if (fileID == "") {
$('.output').text("Please enter a file ID");
} else{
$.ajax({
url : BASE_URL + '/content/v4/nodes/' + fileID,
data : {},
success : function(data) {
$('.output').text("");
var numberOfProperties = data.contents.length;
var properties = new Array();
properties = data.contents;
for (var i = 0; i < numberOfProperties; i++){
$('.output').append("<tr><td>" + "Name: " + properties[i].name + "</td></tr>");
$('.output').append("<tr><td>" + "Description: " + properties[i].description + "</td></tr>");
$('.output').append("<tr><td>" + "versionNum: " + properties[i].versionNum + "</td></tr>");
}
},
error : function(data) {
$('.output').append("failure");
}
});
}
}
But it should be possible to do it much simpeler like so:
for (var i = 0, i < numberOfProperties; i++ {
$('.output').append(properties[i][0], properties[i][1]); // This should be the easy way
}
But that does not return anything. What do I do wrong here?
Thanks,
Roel