0

I have an application build up in SharePoint 2013. In one of the custom list form, we are trying to update list item using Rest API call with type Patch.

Few users are getting a response {"readyState":4,"responseText":"404 NOT FOUND","status":404,"statusText":"NOT FOUND"} , while others are able to update the item successfully.

Code :

function CloseCaseRecord(itemID) {
var item = {
    __metadata: {
        type: "SP.Data.CaseRecordListItem"
    },
    CaseStatus: "Closed"
}
$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('CaseRecord')/items(" + itemID + ")",
    type: "PATCH",
    data: JSON.stringify(item),
    headers: {
        "Accept": "application/json;odata=verbose",
        "Content-Type": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
        "X-HTTP-Method": "PATCH",
        "If-Match": "*"
    },
    success: function(data, status, xhr) {
        alert('Case closed successfully');
        location.reload();
    },
    error: function(data) {
        alert(data.responseJSON.error);
    }
});
}

Note: Same code works fine for the users if the request is changed from type Patch to Post. The issue is inconsistent with users, with Patch method

0

Patch request was getting blocked on server and this issue came up since Microsoft URL Rewrite Module 2.0 for IIS 7 (x64) was installed on the server for some other application by the server admin team.

Due to the URL Rewrite module, few of the Patch requests were getting blocked and returned 404 error

Post Uninstall of this module from the server issue has been resolved.

Microsoft URL Rewrite Module: https://www.iis.net/downloads/microsoft/url-rewrite

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.