processBatchData support for existing $.ajax calls

#4 · closed · 1 comments

View on GitHub ↗

RainerAtSpirit

update caps.processBatchData to the new params validation.

Comments

RainerAtSpirit

Landed in 1.1.0 **Example 1**: batch as object, items as object aka single method, single item support ``` javascript caps.processBatchData({ "listTitle": "Tasks", "batch": { "method": "update", "items": { "Id": 2, "Title": "Update via caps" } } } ) ``` **Example 2**: batch as object, items as array aka single method, multiple items support ``` javascript caps.processBatchData({ "listTitle": "Tasks", "batch": { "method": "create", "items": [ { "Title": "One" }, { "Title": "Two" }, { "Title": "Three" } ] } } ) ``` **Example 3**: batch as array, items as array aka multiple methods, multiple items support ``` javascript caps.processBatchData({ "listTitle": "Tasks", "batch": [ { "method": "update", "items": [ { "Id": 1, "Title": "Updated... again" }, { "Id": 2, "Title": "Updated as well" } ] }, { "method": "create", "items": [ { "Title": "Create one" }, { "Title": "Create two" } ] }, { "method": "delete", "items": [ { "Id": 3 }, { "Id": 4 } ] } ] } ) ``` **Example 4**: options as array, aka multiple lists support ``` javascript caps.processBatchData( [ { "listTitle": "Tasks", "batch": { "method": "create", "items": [ { "Title": "One" }, { "Title": "Two" }, { "Title": "Three" } ] } }, { "listTitle": "Custom", "batch": { "method": "create", "items": [ { "Title": "One" }, { "Title": "Two" }, { "Title": "Three" } ] } } ] ) ```