createUploadJob method

Future<CreateUploadJobResponse> createUploadJob({
  1. required String displayName,
  2. required String domainName,
  3. required Map<String, ObjectTypeField> fields,
  4. required String uniqueKey,
  5. int? dataExpiry,
})

Creates an Upload job to ingest data for segment imports. The metadata is created for the job with the provided field mapping and unique key.

May throw AccessDeniedException. May throw BadRequestException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter displayName : The unique name of the upload job. Could be a file name to identify the upload job.

Parameter domainName : The unique name of the domain. Domain should be exists for the upload job to be created.

Parameter fields : The mapping between CSV Columns and Profile Object attributes. A map of the name and ObjectType field.

Parameter uniqueKey : The unique key columns for de-duping the profiles used to map data to the profile.

Parameter dataExpiry : The expiry duration for the profiles ingested with the job. If not provided, the system default of 2 weeks is used.

Implementation

Future<CreateUploadJobResponse> createUploadJob({
  required String displayName,
  required String domainName,
  required Map<String, ObjectTypeField> fields,
  required String uniqueKey,
  int? dataExpiry,
}) async {
  _s.validateNumRange(
    'dataExpiry',
    dataExpiry,
    1,
    1098,
  );
  final $payload = <String, dynamic>{
    'DisplayName': displayName,
    'Fields': fields,
    'UniqueKey': uniqueKey,
    if (dataExpiry != null) 'DataExpiry': dataExpiry,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/domains/${Uri.encodeComponent(domainName)}/upload-jobs',
    exceptionFnMap: _exceptionFns,
  );
  return CreateUploadJobResponse.fromJson(response);
}