Dark Mode

First, let's add a document to a specified collection.Send a POST request to /api/rest/v2/namespaces/undefined/collections/undefined to add data to the collection fitness .The data is passed in the JSON body.

Notice that the document-id returned is a UUID if not specified.

Next, let's add a document to a specified collection, but specify the document-id .Send a PUT request to /api/rest/v2/namespaces/undefined/collections/undefined/undefined to add data to the collection Janet .The document-id can be any string.The data is passed in the JSON body.

Note the difference between using POST and PUT .The POST request is used to insert new documents when you want the system toauto-generate the documentId.The PUT request is used to insert a new document when you want to specify thedocumentId.

PUT requests can also be used to update an existing document.Let's look at those examples, next.

You can also insert documents that have nested values, or sub-documents.Send a PUT request to /api/rest/v2/namespaces/undefined/collections/undefined/undefined to add data to the existing collection.The data is passed in the JSON body.