'Batch create documents in firestore (with direct api)

I'm trying to update an existing firestore google apps script library to also allow for batch create documents. Now, I understand the existing library as explained very well here. I'm testing with postman and am able to create documents.

Now I would like to create multiple document with a batch write. But I find the Google Documentation quite hard to read. So I was looking for a simple example how the body request looks of a batch write, could someone provide this for me?

I read a comment by LaughDonor here that it should be using these endpoints:

  • Begin Transaction - I have this working and received a transaction token
  • Commit Transaction - could someone provide me with an example of what a Write object would look?
  • Rollback Transaction


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source