How to update document template in ROFS using the Document Management API
In order to update a document template in ROFS, a developer can follow these instructions:
Retrieve a download link to the current letter template to edit by using accessing the document API swagger page and using the GET /api/v1/document/downloadlink/{id} endpoint. You can get the current template GUID from the Rofs code base in DocumentTemplate.cs.
Remove protection on document. In order to edit a document you must click navigate to Developer > Restrict Editing and then click Stop Protection
Make any necessary edits to the document template.
One you are done making edits, add protection back to the document with the settings in the screenshot. After clicking ‘Yes, Start Enforcing Protection’, leave the password field blank , and click OK
Convert the updated word file to bytes by using one of the following tools:
https://cloudmersive.com/convert-file-to-json-byte-array-tool
https://base64.guru/converter/encode/file
This will be used to upload the document in JSON formatUpload document to DMS by using the POST /api/v1/documents endpoint with the following request body depending on your language. Replace the parameters in between {} with your request specific values.
English:{
"userName": "{YourEmail}",
"fileBytes": "{FileBytesFromStep5}",
"fileName": "NotificationLetter.docx",
"fileContentType": "application/msword",
"submissionMethod": "004",
"fileLanguage": "english"
}French:
{
"userName": "{YourEmail}",
"fileBytes": "{FileBytesFromStep5}",
"fileName": "LetterDeNotification.docx",
"fileContentType": "application/msword",
"submissionMethod": "004",
"fileLanguage": "french"
}Get the document id from the response generated in step 6 and update the DocID in Rofs DocumentTemplate.cs.
Make sure to upload the updated template to the upper environments as well , by repeating steps 6-7.