batchPutDocument method
Adds one or more documents to an Amazon Q Business index.
You use this API to:
- ingest your structured and unstructured documents and documents stored in an Amazon S3 bucket into an Amazon Q Business index.
- add custom attributes to documents in an Amazon Q Business index.
- attach an access control list to the documents added to an Amazon Q Business index.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter applicationId :
The identifier of the Amazon Q Business application.
Parameter documents :
One or more documents to add to the index.
Parameter indexId :
The identifier of the Amazon Q Business index to add the documents to.
Parameter dataSourceSyncId :
The identifier of the data source sync during which the documents were
added.
Parameter roleArn :
The Amazon Resource Name (ARN) of an IAM role with permission to access
your S3 bucket.
Implementation
Future<BatchPutDocumentResponse> batchPutDocument({
required String applicationId,
required List<Document> documents,
required String indexId,
String? dataSourceSyncId,
String? roleArn,
}) async {
final $payload = <String, dynamic>{
'documents': documents,
if (dataSourceSyncId != null) 'dataSourceSyncId': dataSourceSyncId,
if (roleArn != null) 'roleArn': roleArn,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/indices/${Uri.encodeComponent(indexId)}/documents',
exceptionFnMap: _exceptionFns,
);
return BatchPutDocumentResponse.fromJson(response);
}