startImportJob method
Start an asynchronous job to import Wisdom resources from an uploaded source file. Before calling this API, use StartContentUpload to upload an asset that contains the resource data.
- For importing Wisdom quick responses, you need to upload a csv file including the quick responses. For information about how to format the csv file for importing quick responses, see Import quick responses.
May throw AccessDeniedException.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter importJobType :
The type of the import job.
-
For importing quick response resource, set the value to
QUICK_RESPONSES.
Parameter knowledgeBaseId :
The identifier of the knowledge base. This should not be a QUICK_RESPONSES
type knowledge base if you're storing Wisdom Content resource to it. Can
be either the ID or the ARN. URLs cannot contain the ARN.
-
For importing Wisdom quick responses, this should be a
QUICK_RESPONSEStype knowledge base.
Parameter uploadId :
A pointer to the uploaded asset. This value is returned by StartContentUpload.
Parameter clientToken :
The tags used to organize, track, or control access for this resource.
Parameter externalSourceConfiguration :
The configuration information of the external source that the resource
data are imported from.
Parameter metadata :
The metadata fields of the imported Wisdom resources.
Implementation
Future<StartImportJobResponse> startImportJob({
required ImportJobType importJobType,
required String knowledgeBaseId,
required String uploadId,
String? clientToken,
ExternalSourceConfiguration? externalSourceConfiguration,
Map<String, String>? metadata,
}) async {
final $payload = <String, dynamic>{
'importJobType': importJobType.value,
'uploadId': uploadId,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (externalSourceConfiguration != null)
'externalSourceConfiguration': externalSourceConfiguration,
if (metadata != null) 'metadata': metadata,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/knowledgeBases/${Uri.encodeComponent(knowledgeBaseId)}/importJobs',
exceptionFnMap: _exceptionFns,
);
return StartImportJobResponse.fromJson(response);
}