With SharePoint REST API you can iterate through all columns. But what happens when you want to display a Person/Group column like the Author? You will get a User ID as a result.
To display the “Authors Full Name” instead of the ID just use the parameter $expand.
var listname = "My List"; var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('"+listName+"')/items? "$select=Id,Title,Created,Author/Title&"+; "$top=20&"+; "$orderby=Created desc&"+; "$expand=Author";
... $.ajax({ url: url , method: "GET", headers: {"Accept": "application/json; odata=verbose" }, success: function (data) { if(data.d.results.length >0){ for (var i = 0; i < data.d.results.length; i++){ data.d.results[i].Author.Title } } } ...
And if you need to use the filter based on the Person/Group column here is how to declare it:
var urlPI = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('"+listName+"')/items?"+ "$select=Author,Author/Title"+ "$top=5000"+ "$orderby=Created desc"+ "$expand=Author&"+ "$filter=Author eq '"+_spPageContextInfo.userId+"'";
.