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
        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) {


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' }
  • as per your program you can only pass one parameter in metadata? Apr 7 '14 at 10:26

In order to set Url Field value in SharePoint REST specify the following JSON object:

URL: {Url: 'http://www.microsoft.com',Description: 'MSFT'}

where URL is the name of a field.


var metadata = { Title: 'myTitle', URL: {Url: 'http://www.microsoft.com',Description: 'MSFT'}};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.