mergeProfiles method

Future<MergeProfilesResponse> mergeProfiles({
  1. required String domainName,
  2. required String mainProfileId,
  3. required List<String> profileIdsToBeMerged,
  4. FieldSourceProfileIds? fieldSourceProfileIds,
})

Runs an AWS Lambda job that does the following:

  1. All the profileKeys in the ProfileToBeMerged will be moved to the main profile.
  2. All the objects in the ProfileToBeMerged will be moved to the main profile.
  3. All the ProfileToBeMerged will be deleted at the end.
  4. All the profileKeys in the ProfileIdsToBeMerged will be moved to the main profile.
  5. Standard fields are merged as follows:
    1. Fields are always "union"-ed if there are no conflicts in standard fields or attributeKeys.
    2. When there are conflicting fields:
      1. If no SourceProfileIds entry is specified, the main Profile value is always taken.
      2. If a SourceProfileIds entry is specified, the specified profileId is always taken, even if it is a NULL value.
You can use MergeProfiles together with GetMatches, which returns potentially matching profiles, or use it with the results of another matching system. After profiles have been merged, they cannot be separated (unmerged).

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

Parameter domainName : The unique name of the domain.

Parameter mainProfileId : The identifier of the profile to be taken.

Parameter profileIdsToBeMerged : The identifier of the profile to be merged into MainProfileId.

Parameter fieldSourceProfileIds : The identifiers of the fields in the profile that has the information you want to apply to the merge. For example, say you want to merge EmailAddress from Profile1 into MainProfile. This would be the identifier of the EmailAddress field in Profile1.

Implementation

Future<MergeProfilesResponse> mergeProfiles({
  required String domainName,
  required String mainProfileId,
  required List<String> profileIdsToBeMerged,
  FieldSourceProfileIds? fieldSourceProfileIds,
}) async {
  final $payload = <String, dynamic>{
    'MainProfileId': mainProfileId,
    'ProfileIdsToBeMerged': profileIdsToBeMerged,
    if (fieldSourceProfileIds != null)
      'FieldSourceProfileIds': fieldSourceProfileIds,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/domains/${Uri.encodeComponent(domainName)}/profiles/objects/merge',
    exceptionFnMap: _exceptionFns,
  );
  return MergeProfilesResponse.fromJson(response);
}