I have a list with a title and a url. I'm trying to add a new url using this function
function addListItem(url, listname, metadata, success, failure) {
// Prepping our update
var item = $.extend({
"__metadata": { "type": getListItemType(listname)}
}, metadata);
// Executing our add
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(item),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
success(data); // Returns the newly created list item information
},
error: function (data) {
failure(data);
}
});
}
I can set the title using this metadata item:
metadata = { Title: 'myTitle' }
But how can I set the url in this context? This doesn't work:
metadata = { Title: 'myTitle', Url: 'http://myspurl' }