Recommended way to upload DocumentRevisions via API?

Hi everyone!

I’m uploading a bunch of documents to SuiteCRM via the v8 API. It works nicely except when I introduce the additional complexity of handling revisions :frowning: That is, what I’m trying to do is attach a new DocumentRevision to an existing Document.

Here’s what I’m doing right now:

POST v8/modules/DocumentRevisions
'data': {'attributes': {'date_entered': '2013-11-22',
                         'doc_type': '',
                         'document_id': u'8f69e8ac-6671-1ab2-d6a0-5bc5f97d8488',
                         'document_name': 'revision 02',
                         'file_ext': 'pdf',
                         'filename': 'document02.pdf',
                         'filename_file': <OMITTED>,
                         'revision': '02'},
          'type': 'DocumentRevisions'}}

The new revision DOES get created and I can see it correctly from the UI, the only problem is that when I try to download it, it fails because no file has been saved server-side :confused:
Looking at the code, this happens because while the Document class extends File, DocumentRevision does not, so SuiteCRM doesn’t look for an uploaded file when it saves the DocumentRevision bean.
My question is: is there another method to attach new revisions to an existing Document using the v8 API? Or is it a bug that DocumentRevision DOESN’Textend File?

Many thanks for your time!

The v8 API is quite new and it’s perfectly possible that you are the first person trying to add Revisions through it… so yes, it could be a bug or even a missing bit of code.

The next version (7.10.10) will contain API developments, and there is some new documentation being prepared for it.

I don0t know if it helps, but you can see a preview here:


But this is a work in progress…

You can also grab newer v8 API code from the hotfix branch on Github, if you like living on the edge B-)

I’ve checked the hotfix branch but DocumentRevision is still just a SugarBean there, and the code that saves uploaded files has no modification… I’ll experiment with my installation then, thanks :slight_smile:

Did you figure this out? This is the last piece before I can close the books on my SF to SuiteCRM migration.

Never mind, I think you can write direct to DocumentRevisions module now. I am going to give a try and I will report back. I know this thread is old, but it is the only relevant one related to Document Revisions and the API.



    "data": {
        "type": "DocumentRevision",
        "id": "<DR ID>",
        "attributes": {
			"change_log": "Document Created",
			"document_id": "<Document ID>"

If any of the people on this thread would be willing to improve the existing Documentation on the API, we would be very grateful. The Docs are too outdated, wrong and incomplete, as you probably know and have suffered from it.

Our Docs site is wiki-style, it is editable by the Community, so any improvements you can make will be valuable.

You can make simple edits:

Or set up a nicer local environment for more extensive edits:

I can help, if necessary.

1 Like

Thanks, pgr. I do plan to do this. I have spent the last month migrating to SuiteCRM, and I really want to work on the documentation and provide the migration/admin tools I used for the benefit of the SuiteCRM community. I also have more free time now that the migration is almost complete.

GitHub for where I will upload tools.

Cool B-) thanks!