Skip to main content

Data Transformations - Update Rule

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/i/data-manager/transformation/edit

Overview

Updates an existing transformation rule by ID.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

Requires data_manager_transformations Update permission.

Request Parameters

ParameterTypeRequiredDescription
app_idStringYesTarget app ID.
idStringYesTransformation document ID.
transformationJSON String (Object)YesUpdated transformation payload.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

transformation Object Structure

FieldTypeRequiredDescription
actionTypeStringYesOperation type: rename, merge, change-value, copy-to-user-custom.
transformTargetArrayYesSource key(s) or event(s) to transform.
transformResultStringYesTarget key/name/value produced by transformation.
transformationProcessTargetStringNoProcessing scope metadata: incoming, existing, both.
parentEventStringNoEvent context or CUSTOM_PROPERTY.
targetRegexStringNoRegex pattern used by value-change and regex flows.
isRegexBoolean/StringNoRegex mode flag.
isRegexMergeBoolean/StringNoRegex merge mode flag.
sourceEventDeleteBoolean/StringNoSource cleanup flag for merge workflows.
isExistingEventBoolean/StringNoExisting-event handling flag.
statusStringNoRule status value.

Decoded example:

{
"actionType": "rename",
"parentEvent": "purchase",
"transformTarget": ["region_code"],
"transformResult": "region",
"transformationProcessTarget": "incoming"
}

Parameter Semantics

FieldExpected valuesBehavior
transformation.actionTyperename, merge, change-value, copy-to-user-customControls how the rule updates names, merges values, rewrites values, or copies segment values. Invalid combinations return generic 500 Error.
transformation.transformationProcessTargetincoming, existing, bothStored in rule metadata; this endpoint does not run historical reprocessing.

Examples

/i/data-manager/transformation/edit?
app_id=64f5c0d8f4f7ac0012ab3456&
id=67b860e39f2d3e0012ab9c44&
transformation={
"parentEvent":"purchase",
"transformTarget":["region_code"],
"transformResult":"region",
"actionType":"rename",
"transformationProcessTarget":"incoming"
}

Response

Success Response

"Success"

Response Fields

FieldTypeDescription
(root value)StringSuccess when update completes.

Error Responses

  • 500
{
"result": "Error"
}

Behavior

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Update ruleAlwaysParses transformation payload and updates the matching rule by _id + app, including cleanup of removed optional fields.Raw root string: "Success"

Impact on Other Data

  • Updates transformation document in countly.datamanager_transforms.
  • Invalidates transformation cache for the app.

Operational Considerations

  • No long-task branch is executed for update in the current endpoint behavior.

Limitations

  • Malformed JSON in transformation or invalid transform mapping returns generic 500 Error.
Implementation details

Audit & System Logs

ActionTriggerPayload
dm-transformation-editAfter successful update{ transform: JSON.stringify(transform), id: id }

Database Collections

CollectionUsed forData touched by this endpoint
countly.datamanager_transformsTransformation rule storageUpdates existing rule document by _id + app, including $set and $unset of optional fields.
countly.systemlogsAudit trailWrites dm-transformation-edit with updated payload and rule ID.