Append content to a collaborative document via the API

Hey everyone,

i am trying to append some content to a collaborative document. The API docs explain how to set the content (batched):

curl -X POST 'https://YOUR_ACCOUNT.fibery.io/api/documents/commands?format=md' \
     -H 'Authorization: Bearer <token>' \
     -H 'Content-Type: application/json' \
     -d \
      '{
         "command": "create-or-update-documents",
         "args": [
           {
             "secret": "b33a25d1-99ba-11e9-8c59-09d0cb6f3aeb",
             "content": "my md content 1"
           },
           {
             "secret": "b33a25d3-99ba-11e9-8c59-09d0cb6f3aeb",
             "content": "my md content 2"
           }
         ]
      }'

However, for this I would have to retrieve the content of the document first, append the new content and finally set the document via the request above.

Is there an option to append content as well? This would also be a lot safer as the existing content is not touched at all.

Cheers,
Ben

1 Like

yes,

You can try changing command to “create-or-append-documents” or “create-or-prepend-documents”.
Unfortunately they are not documented yet but the API format should be the same

1 Like

Thanks that was exactly what I was looking for! Fibery API proves to be awesome once again :smiling_face_with_sunglasses: