I know the OData batch process built into SharePoint Online 2016 and O365 has not made it to SharePoint 2013 Online, but I have read a few places that say using a batch create/update IS possible in SP2013 by using the SP2010 _vti_bin/listdata.svc to do batch updates/inserts. In fact I have some code I use in Excel that does something similar by writing the entire range of data to SharePoint in a batch using the vti_bin/listdata.svc method, but I haven't figured out how to do this using the REST API yet as there are a lot of extra steps.

I have read postings on the SharePoint Stack Exchange from the following places that tell how to do it:

Cannot find resource for the request $batch Sharepoint server 2013

$batch operations on SharePoint 2013 on-premise not working

Except I cannot get it to work. I am following the code in this example and making the changes as needed looking at the pastebin example the one person posted here, but have been unsuccessful in getting it to work.

I am following the instructions from here: http://www.c-sharpcorner.com/UploadFile/780289/save-mutiple-records-to-sharepoint-2013-using-rest-api-in-a/

and from what they are saying it looks very similar to what he has in there.

Here is the code I am using:

this.batchUpdate = function (model, list, errorMsg) {
            var batchContents = new Array();
            var changeSetId = self.generateUUID();
            var batchUuid = self.generateUUID();
            var endpointUrl = SPUrl + '_vti_bin/listdata.svc/' + list

            //create the changeSet
            for (var index = 0; index < model.length; index++) {

                batchContents.push('--changeset_' + changeSetId);
                batchContents.push('Content-Transfer-Encoding: binary');
                batchContents.push('POST ' + endpointUrl + ' HTTP/1.1');
                batchContents.push('Content-Type: application/json;odata=verbose');
                batchContents.push('Accept: application/json');
            //End changeset to create Data
            batchContents.push('--changeSetId_' + changeSetId + '--');

            //generate batch body
            var batchBody = batchContents.join('\r\n');

            endpointUrl = SPUrl + '/_vti_bin/listdata.svc/$batch';

            //create batch specific header
            var batchRequestHeader = {
                'X-RequestDigest': $("#__REQUESTDIGEST").val(),
                'Content-Type': 'multipart/mixed; boundary="batch_' + batchUuid + '"'

            return $.ajax({
                url: endpointUrl,
                type: 'POST',
                headers: batchRequestHeader,
                data: batchBody
            }).then(function (data, request) {
                return data.d;
            }, function (error) {
                errorMsg !== undefined && errorMsg !== null ? alertify.error(errorMsg + error.status) : null

Any help would be greatly appreciated, I really need to get this functionality working ASAP!!

  • Are you getting any errors? Did you check the batchBody and batchRequestHeader after setting the value, does it look correct?
    – Abbas
    Commented Mar 22, 2018 at 9:29

1 Answer 1


"SharePoint Online (and on-premises SharePoint 2016 and later) and the Office 365 APIs implement the OData $batch query option " https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/make-batch-requests-with-the-rest-apis I don't think you can make it work in SP2013...

  • Someone says they were able to get it working in SP 2013...it doesn't matter at this point I just created a loop through the items that needed to be updated and it works fine.
    – MattE
    Commented Apr 25, 2018 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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