I am using on premise SharePoint server 2016.I am using rest api to update a list.I have a list having space in it's name so while passing this name it causes problem.Is it possible to pass file name having space to update operation. Suppose list name is 'abc list'.
$.ajax
({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('abc%20list')/items("+Idtoupdate+")", // list item ID
type: "POST",
data: JSON.stringify
({
__metadata:
{
type: "SP.Data.abc%20list"
},
Uploaded:value
}),
headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": "MERGE"
},
async: false,
success: function(data, status, xhr)
{
debugger;
},
error: function(xhr, status, error)
{
debugger;
}
});
I am getting error at json.strignify.
Error:
{"readyState":4,"responseText":"{\"error\":{\"code\":\"-1, Microsoft.SharePoint.Client.InvalidClientQueryException\",\"message\":{\"lang\":\"en-US\",\"value\":\"A type named 'SP.Data.Approver DashboardListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.\"}}}","responseJSON":{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"A type named 'SP.Data.Approver DashboardListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type."}}},"status":400,"statusText":"Bad Request"}
/_api/web/lists/GetByTitle('listName')/ListItemEntityTypeFullName
to check theListItemEntityTypeFullName
for your list.