I have a list in SP 2013 with 4 Columns
Date Created -- Country -- Price in US Dollars -- Modified
After a bunch of help from the community I have created a Rest API for this list, but now i'm running into issues with the API pulling all of the data associated with the objects. I am trying to get the API to just pull the items in the columns above, which have 34 objects total in within each column.
This is the Select process that I have tried thus far, any help would be greatly appreciated. Still learning.
function retrieveListItems() {
var siteUrl = _spPageContextInfo.webAbsoluteUrl;
var fullUrl = siteUrl + "/_api/web/lists/GetByTitle('Demo List')/items?$select=Id,Title,Modified,Created"
//console.log(siteUrl);
console.log(fullUrl);
$.ajax({
url: fullUrl,
type: "GET",
//Tried with nometadata and verbose
/*headers: {
"accept": "application/json;odata=nometadata",
"content-type": "application/json;odata=nometadata",
},*/
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
},
success: onQuerySucceeded,
error: onQueryFailed
});
}
function onQuerySucceeded(data) {
var listItemInfo = '';
$.each(data.d.results, function (key, value) {
listItemInfo += '<strong>ID: </strong> ' + value.Id + ' ' +
' <strong>Title:</strong> ' + value.Title + ' ' +
' <strong>Date posted:</strong> ' + new Date(value.Created).toLocaleDateString() + ' ' +
' <strong>Date modified:</strong> ' + new Date(value.Modified).toLocaleDateString() + ' ' +
'<br />';
});
$("#divGetListData").html(listItemInfo);
}
function onQueryFailed(sender, args) {
alert('Error!');
}