Creating Document Revision with REST v11

Hello, 
I'm new to SugarCRM 13 and am running into some issues converting what we had in 6.5 to 13. I have many REST calls that use to create documents and document revisions. 

According to the new Endpoints, there doesn't seem to be one to create document revisions. 

I tried to follow this guide with the document module: https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/PHP/How_to_Manipulate_File_Attachments/index.html

however, it always gives this error:

(
[error] => missing_parameter
[error_message] => Attachment is missing
)

I'm setting the <attachment field> to "filename" like the example. Should I be using something else for the document module? or is there another way to upload files to the documents module.

I am calling "Documents/<id>/file/filename" and have removed the content type from my headers.

Any help would be appreciated

  • Hi Lily,

    The endpoint looks to be Documents/(record id)/link/revisions in my test. I often find answers for REST questions by using the developer features in the browser. I used these steps to test:

    I opened the dev panel ( usually the F12 key )

    Next I selected the Network tab in the panel.

    I navigated to the page where the action I want can be performed in Sugar. ( created a document, went back to it chose to add a revision )

    Next I click the circle-X or trash icon for the network tab to clear that history.

    I fill any fields and click save.

    The details are found in the request that seems to match what I need. The URL and then the request body.

    See the result of the test below. the REST version for your site may differ from 11_21.

    POST
    https://mysugarsite.sugarondemand.com/rest/v11_21/Documents/45915a8a-57f7-11ee-9c49-02a5a97c2d5e/link/revisions?erased_fields=true&viewed=1
    BODY
    {"deleted":false,"document_name":"Test1","latest_revision":"1","revision":"2","doc_type":"Sugar","filename":"Sugar Plug In.docx","filename_guid":"6220df9a-57f7-11ee-9ec1-02a5a97c2d5e","file_mime_type":"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}

    I hope this helps and please share any questions.

    Kind Regards,

    Forest Basford

    SugarCRM Support