Sharepoint - Create multiple items via REST API
Unfortunately, the REST API does not provide a way to batch items (yet). However, you can batch add items using the JavaScript Client Object Model. Here is a sample code:
var itemArray = [];
function createListItems() {
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('TestList');
for(var i = 0; i< 5; i++){
var itemCreateInfo = new SP.ListItemCreationInformation();
var oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', 'My New Item!' + i);
oListItem.update();
itemArray[i] = oListItem;
clientContext.load(itemArray[i]);
}
clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}
function onQuerySucceeded() {
alert('Items created');
alert(itemArray[0].get_id());
alert(itemArray[0].get_item("Title"));
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
createListItems();
Update
REST API supports batching now:
https://dev.office.com/sharepoint/docs/sp-add-ins/make-batch-requests-with-the-rest-apis
http://www.vrdmn.com/2016/06/sharepoint-online-get-userprofile.html
Batching is now supported in REST O365 only. You can check out a javascript library on GitHub that batches these for you using the new capabilities.
https://github.com/SteveCurran/sp-rest-batch-execution