I have a SharePoint list (let's call it 'Employee') and I am using jQuery and REST to read and write properties on that list.
If I want to update e.g. an int property (let's call it 'EmployeeAge'), it's quite straightforward:
jQuery.ajax({
url: myUrl,
type: "POST",
data: JSON.stringify({ '__metadata': { 'type': 'SP.Data.EmployeeListItem' }, 'EmployeeAge': age }),
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": 0,
"X-HTTP-Method": "MERGE",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*"
},
success: successHandlerUpdateEmployeeAge,
error: errorHandlerUpdateEmployeeAge
});
Now I want to use the same principle to update another column of the list. Let's call it 'EmployeeImage'. The column is of type Hyperlink/Picture and sub type Picture. I want to set the image url attribute of the column for a particular list item.
How do I format the data attribute in my ajax call to support this type of update?
I can find a thousand samples on how to update a title field, but none regarding update of complex types like this.