Downloading Assembled Documents
Once you have a completed work item version, you can download the documents assembled. This action is typically performed at the request of the end user who has just finished the interview.
Prerequisites
Before making a request to download the documents, you must have an access token to sign the request. You can retrieve an access token using one of the following flows:
- Getting an access token using the Resource Owner flow
- Getting an access token using the Implicit flow
Additionally, you must have the following items:
-
A work item with a completed version (see Completing a Work Item Version)
Overview
The 'download assembled documents' API method is a query method. The API client invoking this method must have a query scope.
The downloading assembled documents method requires two API requests:
- Get a list of work item documents
- Download the document(s)
You can then download the assembled documents by handling the response stream.
Authentication
See Authentication for more information about authenticating requests to the Advance API.
API Documentation
You can view the latest reference documentation for the Advance API at https://yourorganization.com/HdaApi/rest/documentation/index.html, where yourorganization.com is the domain under which your Advance deployment is located.
Request
Request URL
You can return the documents for the latest version of a work item or specify a particular version:
GET https://{tenancymoniker}.{domain}/HdaApi/rest/v2.0/WorkItems/{workItemId}/Documents
GET https://{tenancymoniker}.{domain}/HdaApi/rest/v2.0/WorkItems/{workItemId}/Versions/{versionId}/Documents
And
GET https://{tenancymoniker}.{domain}/HdaApi/rest/v2.0/WorkItems/{workItemId}/Documents/{documentId}/Content
GET https://{tenancymoniker}.{domain}/HdaApi/rest/v2.0/WorkItems/{workItemId}/Documents/{documentId}/Versions/{versionId}/Content
Headers
Key | Required | Description | Example value |
Authorization | Yes | The Authorization header for the request. Uses the access token retrieved (see Prerequisites section above for more information). | Bearer [access token] |
Parameters
Name | Type | Location | Required | Description |
tenancymoniker | String | URL | Yes | The tenancy moniker for the tenancy in which you want to create the new work item. |
domain | String | URL | Yes | Your domain. For example, yourorganization.com. |
workItemItd | Guid | URL | Yes | The Guid for an existing work item. |
versionId | Guid | URL | No | The Guid for a work item version associated with the work item. |
documentId | Guid | URL | Yes | The Guid for a document within a work item. |
Examples
Example Request URL
https://yourtenancy.yourorganization.com/HdaApi/rest/v2.0/WorkItems/2d9f3d10-6fdb-494f-9929-955515c6f114/Documents
https://yourtenancy.yourorganization.com/HdaApi/rest/v2.0/WorkItems/2d9f3d10-6fdb-494f-9929-955515c6f114/Documents/11cd9164-758b-4880-9442-a512c8e62fcd/Content
Example Request JSON
{}
Example Response
Status: 200 OK
Example JSON Response Data
/Documents:
{
"documentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"workItemVersionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"templatePackageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"templatePackageVersionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"assembledOrder": 0,
"name": "string",
"fileName": "string",
"type": "string",
"createdDate": "2024-06-26T11:49:29.385Z",
"hasContent": true,
"postProcessedBy": {
"userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"fullName": "string"
},
"isHidden": true,
"assemblyResults": {
"allReferencedVariablesAnswered": true,
"unansweredVariables": [ "string" ]
},
"urls": {
"documentContentUrl": "string" }
}
/Content:
"string"