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