I have a SharePoint 2013 page that I want to make updates to a hyperlink field in a list. I'm calling the REST API using JavaScript + jQuery.

My code (my hyperlink field is Timesheet_x0020_Page):

self.UpdateTimesheet = function(id, state) {
    var data = {
        '__metadata': { 'type': 'SP.Data.TimesheetListItem' },
        'Timesheet_x0020_Page': 'http://google.com, Google',
        'State': state
    var url = "/_api/Web/Lists(guid'e95f5b86-64dd-41d9-9973-493d906ce75e')/Items(" + id + ")";
    var promise = $.ajax({
        'url': url,
        type: "POST",
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(data),
        headers: {
            "Accept": "application/json;odata=verbose",
            "X-HTTP-Method": "MERGE",
            "IF-MATCH": "*",
            "X-RequestDigest": $("#__REQUESTDIGEST").val()
    return promise;

But I get the following error:

{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected."}}}


You should try to using this. It may help you:

 var data = {
        '__metadata': { 'type': 'SP.Data.TimesheetListItem' },
                    '__metadata': { 'type': 'SP.FieldUrlValue' },
                    'Description': 'Google',
                    'Url': 'http://google.com'
        'State': state
  • Interested to see if that fixes it. I had the same issue earlier this week (calling from workflow). Rest API documentation really needs to be beefed up. – Russell Jan 23 '14 at 2:58
  • 2
    Yep that was it, thanks. Pretty interesting that values can have __metadata object. – Kit Menke Jan 23 '14 at 3:05
  • Is there a web site we can go to learn or see more metadata combinations for various columns, not just hyperlinks? but for example, images...? – klewis Mar 24 at 14:36

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.