@@ -420,10 +420,11 @@ <h3 id="bulk-create">Bulk Create</h3>
420420
421421 < p >
422422 Add multiple completely new objects to RERUM and receive an array of the complete records as the response body.
423- Accepts only a single array of JSON objects in the request body.
424- The array of JSON objects passed in will be created in the order submitted and the response will have the URI
425- of the new resource or an error message as an array in the same order. When errors are encountered,
426- the batch process will attempt to continue for all submitted items.
423+ Accepts only a single array of JSON objects in the request body. The '@id' property must not be present on the objects.
424+ In cases where the Linked Data @context property maps '@id' to 'id', the 'id' property also must not be present.
425+ The array of JSON objects passed may not be created in the order submitted. The response will have the URI
426+ of the new resource or an error message as an array in the order the order the objects were processed.
427+ When errors are encountered, the batch process will attempt to continue for all submitted items.
427428 </ p >
428429
429430 < p >
@@ -730,6 +731,80 @@ <h3 id="update">Update</h3>
730731 </ p >
731732 </ p >
732733
734+ < h3 id ="bulk-update "> Bulk Update</ h3 >
735+
736+ < table >
737+ < thead >
738+ < tr >
739+ < th > Patterns</ th >
740+ < th > Payloads</ th >
741+ < th > Responses</ th >
742+ </ tr >
743+ </ thead >
744+ < tbody >
745+ < tr >
746+ < td > < code class ="language-plaintext highlighter-rouge "> /bulkUpdate</ code > </ td >
747+ < td > < code class ="language-plaintext highlighter-rouge "> [{JSON}]</ code > </ td >
748+ < td > 201 < code >
749+ < code class ="language-plaintext highlighter-rouge "> [{JSON}]</ code > </ td >
750+ </ tr >
751+ </ tbody >
752+ </ table >
753+
754+ < ul >
755+ < li > < strong > < code class ="language-plaintext highlighter-rouge "> [{JSON}]</ code > </ strong > —an array RERUM objects
756+ to be updated.</ li >
757+ < li > < strong > Response: < code class ="language-plaintext highlighter-rouge "> [{JSON}]</ code > </ strong > —an array
758+ of the resolved records from the update process</ li >
759+ </ ul >
760+
761+ < p >
762+ Update multiple existing RERUM objects at once and recieve an array of the complete records as the response body.
763+ Accepts only a single array of JSON objects in the request body. The '@id' property must be present for each object.
764+ In cases where the Linked Data @context property maps '@id' to 'id' either of these properties will be sufficient.
765+ The array of JSON objects passed in may not be updated in the order submitted. The response will have the URI
766+ of the new resource or an error message as an array in the order the objects were processed. When errors are encountered, the batch process will attempt to continue for all submitted items.
767+ </ p >
768+
769+ < p >
770+ < div class ="exHeading "> Javascript Example</ div >
771+ < pre > < code class ="jsExample ">
772+ < span > const saved_obj = await fetch("https://devstore.rerum.io/v1/api/bulkUpdate", {</ span >
773+ < span class ="ind1 "> method: "POST",</ span >
774+ < span class ="ind1 "> headers:{</ span >
775+ < span class ="ind2 "> "Authorization": "Bearer eyJz93a...k4laUWw" </ span >
776+ < span class ="ind2 "> "Content-Type": "application/json; charset=utf-8"</ span >
777+ < span class ="ind1 "> },</ span >
778+ < span class ="ind1 "> body: JSON.stringify([
779+ < span class ="ind2 "> "@id": "https://devstore.rerum.io/v1/id/abcdef1234567890",</ span >
780+ < span class ="ind2 "> "hello": "new world",</ span >
781+ < span class ="ind2 "> "@id": "https://devstore.rerum.io/v1/id/1234567890abcdef",</ span >
782+ < span class ="ind2 "> "goodbye": "old planet"</ span >
783+ < span class ="ind1 "> ])</ span >
784+ < span > })</ span >
785+ < span > .then(resp => resp.json())</ span >
786+ < span > .catch(err => {throw err})
787+ </ code > </ pre >
788+ </ p >
789+
790+ < p >
791+ < div class ="exHeading "> Here is what the response < code > resp</ code > looks like:</ div >
792+ < pre > < code class ="respExample ">
793+ < span > [</ span >
794+ < span class ="ind1 "> {</ span >
795+ < span class ="ind2 "> "@id": "https://devstore.rerum.io/v1/id/abcabc1231231230",</ span >
796+ < span class ="ind2 "> "hello": "new world",</ span >
797+ < span class ="ind2 "> "__rerum":{...}</ span >
798+ < span class ="ind1 "> },</ span >
799+ < span class ="ind1 "> {</ span >
800+ < span class ="ind2 "> "@id": "https://devstore.rerum.io/v1/id/defdef4564564567",</ span >
801+ < span class ="ind2 "> "goodbye": "old planet",</ span >
802+ < span class ="ind2 "> "__rerum":{...}</ span >
803+ < span class ="ind1 "> }</ span >
804+ < span > ]</ span >
805+ </ code > </ pre >
806+ </ p >
807+
733808 < h3 id ="overwrite "> Overwrite</ h3 >
734809
735810 < p >
0 commit comments