0

I am using the python SDK for Dropbox to make updates to 'Dropbox Paper' documents. In order to achieve this I need to be able to get the latest file revision number.

This can be done using files_list_revisions but I cannot get it to work. I've spent hours troubleshooting and I'm at a total loss. I'm trying to get the revisions using the doc id instead of the file path which appears to be possible according to documentation. To my knowledge Dropbox Paper files do not have file paths so using the doc id is the only way to go.

currently my code looks like this...

import dropbox
from dropbox.files import ListRevisionsMode

dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')

dbx.files_list_revisions('my_doc_id', mode=ListRevisionsMode('my_doc_id'))

this returns AssertionError: Invalid tag

I have also tried

dbx.files_list_revisions('my_doc_id', mode=ListRevisionsMode.id)

which returns

dropbox.stone_validators.ValidationError: 'my_doc_id' did not match pattern '/(.|[\r\n])*|id:.*|(ns:[0-9]+(/.*)?)'

The goal is to get the latest revision number and then update the Paper doc using

dbx.paper_docs_update(data_to_append, 'append', revision_num, 'plain_text')

Update:

I read the regex pattern from the second error and it appears the file id should be written like this id:my_doc_id

I made this correction and got a new error.

dropbox.exceptions.ApiError: ApiError('my_doc_id', ListRevisionsError('path', LookupError('not_found', None)))
freefly0313
  • 105
  • 4
  • 14

1 Answers1

0

The files_list_revisions method (as well as the other files methods), are only for interacting with Dropbox files/folders, not Paper documents.

There isn't a way to programmatically retrieve Paper document revisions, but I'll pass this along as a feature request.

Greg
  • 16,359
  • 2
  • 34
  • 44
  • This seems interesting to me becuase there is a `paper_docs_update` method that requires the revision number in order to update. Without the revision number the update method is useless. – freefly0313 Feb 28 '19 at 05:06
  • Yes, [the `revision` parameter on /2/paper/docs/update](https://www.dropbox.com/developers/documentation/http/documentation#paper-docs-update) is there "to prevent colliding writes." It needs to match the previous value so you don't accidentally overwrite new changes. The API doesn't offer a way to list all of the revisions though. – Greg Feb 28 '19 at 17:02