Update an Answer Set Programmatically
You can update an answer set externally, and then return it to Advance using an API call. This is useful if you have external data you wish to add, for example a reference number from a third-party application.
Overview
When data is added to a work item, Advance saves this in the form of HotDocs Answer XML. Typically new information is added to an answer set through an interview with a user, but it is also possible to update an answer set externally and return this data to HotDocs.
Take care when sending HotDocs Answer XML to a work item that has existing work item versions. When you begin an assembly session and attach new Answer XML, HotDocs replaces the existing Answer XML file with the new file. If there are existing answers which you wish to retain, ensure you keep them in the replacement answer file.
Workflow
You first query a work item version for the Answer XML you wish to update. Then you can edit or update the answer set in your own applications or processes. To return the updated answer set to Advance, you use the begin assembly session API method to create a new assembly session for a work item, attaching your answer data as HotDocs Answer XML.
Validating the HotDocs Answer Set XML
When sending HotDocs answer set XML, you must first validate the answer set against the HotDocs answer Set schema.
To retrieve and update existing answer sets
To return an existing answer set for a work item, you use the following endpoint:
- GET /WorkItems/{workItemId}/AnswerFile/Content — returns the answer set in either HotDocs Answer XML or JSON format.
To update an answer set in this way, choose the HotDocs Answer XML format.
You can now edit or update the answer set as needed. Be sure to keep any answers you wish to retain.
Once you are happy with your answer set, begin an assembly session, attaching your Answer XML in the body of the request.
There are additional considerations if you are updating image values in your answer set.
Next Steps