getDocumentContent method
Retrieves the content of a document that was ingested into Amazon Q Business. This API validates user authorization against document ACLs before returning a pre-signed URL for secure document access. You can download or view source documents referenced in chat responses through the URL.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter applicationId :
The unique identifier of the Amazon Q Business application containing the
document. This ensures the request is scoped to the correct application
environment and its associated security policies.
Parameter documentId :
The unique identifier of the document that is indexed via BatchPutDocument
API or file-upload or connector sync. It is also found in chat or chatSync
response.
Parameter indexId :
The identifier of the index where documents are indexed.
Parameter dataSourceId :
The identifier of the data source from which the document was ingested.
This field is not present if the document is ingested by directly calling
the BatchPutDocument API. If the document is from a file-upload data
source, the datasource will be "uploaded-docs-file-stat-datasourceid".
Parameter outputFormat :
Document outputFormat. Defaults to RAW if not selected.
Implementation
Future<GetDocumentContentResponse> getDocumentContent({
required String applicationId,
required String documentId,
required String indexId,
String? dataSourceId,
OutputFormat? outputFormat,
}) async {
final $query = <String, List<String>>{
if (dataSourceId != null) 'dataSourceId': [dataSourceId],
if (outputFormat != null) 'outputFormat': [outputFormat.value],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/index/${Uri.encodeComponent(indexId)}/documents/${Uri.encodeComponent(documentId)}/content',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return GetDocumentContentResponse.fromJson(response);
}