Skip Navigation LinksHome Page > Forums > SpiraPlan Forums > SpiraPlan Issues & Questi... > Updating document content...
Is there any way to update the content of a document through the API? I'm not talking about the information about the document, which can be updated with a PUT call to /projects/{project_id}/documents. I'm talking about the actual binary content of the document.
The only way I can see to update the content of a document programmatically is by uploading a new copy of the document and deleting the existing one.
Hello,
I think that it is not currently possible - there is no direct “replace binary content” call on an existing document record.
If Spira receives a POST request with a DocumentId that already exists, it will automatically append the new BinaryData as a brand-new version (e.g., v2.0) of that existing document, rather than creating a new record.So, yes - because Spira uses built-in version control, the correct way to update the content programmatically is to upload the new copy as a new version of the same document.
Why this is the best practice:
- It preserves Links: The DocumentId remains the same, so any existing artifacts linked to this document will now seamlessly point to the newly uploaded version.- History is being maintained: If you look at the document in the Spira UI, you will see the new binary file as the "Current Version," but users can still go to the "Versions" tab to see the previous iterations.
Hope that helps.
Regards,Victoria -
And if you have any questions, please email or call us at +1 (202) 558-6885