User profiles import

Use this feature to UPSERT or DELETE user profiles in your datamart.

How-to

Use the bulk import endpoints to create a document import with theUSER_PROFILEdocument type and APPLICATION_X_NDJSON mime type. Only ndjson data is supported for user profiles.

Then, create an execution with your user profile import commands formatted in ndjson .

User profile import command

Each line in the uploaded file can have the following properties:

property
type
description

operation

Enum

Either UPSERT or DELETE

compartment_id

String (Optional)

The Compartment ID, acting as a user identifier in correlation with user_account_id

user_account_id

String (Optional)

The User Account ID, acting as an identifier in correlation with compartment_id

email_hash

String (Optional)

The Email Hash, acting as an identifier

user_agent_id

String (Optional)

The User Agent ID, acting as an identifier

update_strategy

Enum (Optional)

Only considered when operation == UPSERT Values are PARTIAL_UPDATE, PARTIAL_DELETE, FORCE_REPLACE

user_profile

JSON Object (Optional)

Mandatory when operation == UPSERT.

JSON Object representing the User Profile. Please refer to the user profile object for more information.

Example

First create the document import using the call below. You can also reuse a document import that was previously created

Each user profile import you do will be a new execution of the document import created. Here is an example :

Available update strategies when updating existing user profiles

When doing an UPSERT if you want to update existing profiles in your datamart you should use the update_strategy property.

PARTIAL_UPDATE and PARTIAL_DELETE

If you wish to perform targeted updates on existing profiles without overwriting the whole existing user profile object, you should use the PARTIAL_UPDATE or PARTIAL_DELETE values of the update_strategy property.

There are 2 main usage for these strategies :

  1. Dealing with arrays of objects

If you're dealing with arrays of objects, these strategies work together with two directives that should be defined on the schema of the datamart you are working on. In this case, you should first update the schema in order to include the directives.

If you want to make targeted updates on a object that has "id-like" field that can be used to identify the object, use @UpdateStrategyKey

  • Mark the field with the directive inside the given object you would like to make updates on. The field that has the directive will serve to identify the given object based on the value of this field in the update request.

    • For example of where the directive is needed, see use cases #1 to #5 below.

If you want to make targeted updates on a object that does not have a field that can be used to identify the object you should use @UpdateValueObject

  • Mark the object with the directive : send in the payload with the new value of the object and it will override the previous value.

    • For example of where the directive is needed, see use case #6 and #7 below.

  1. Dealing with objects

When there are no arrays of objects involved, you can still use the PARTIAL_UPDATE but the no directive is necessary. For examples, check use cases #8 to #10.

#1 - Add an object in array of objects - PARTIAL_UPDATE using the @UpdateStrategyKey directive

#2 - Update a property in an array of objects - PARTIAL_UPDATE using the @UpdateStrategyKey directive

Remark : arrays of scalar values are treated as scalars. See example below :

#3 - Delete a property inside an array of objects - PARTIAL_UPDATE using the @UpdateStrategyKey directive

For a non mandatory value you can also set a given field to null (but not an object directly). For instance in the previous example you could have done the following :

#4 - Update object inside an array and add new object - PARTIAL_UPDATE using the @UpdateStrategyKey directive

#5 - Delete an object in an array of objects - PARTIAL_DELETE using the @UpdateStrategyKey directive

#6 - Override an array of objects - PARTIAL_UPDATE using the @UpdateValueObject directive

#7 - Override an object - PARTIAL_UPDATE using the @UpdateValueObject directive

#8 - Update properties inside the UserProfile - PARTIAL_UPDATE with no directive

#9 - Update a property inside an object - PARTIAL_UPDATE with no directive

#10 - Override an object - PARTIAL_UPDATE with no directive

Constraints and limitations

Schema related constraints :

The update request must respect the datamart schema :

  • If a property is in the payload of the request but not declared in the schema, the whole request will fail. However, if a property is already present in the profile but not declared in the schema, it will not be overwritten by a partial update or delete. In fact it will not be possible to update such property unless using FORCE_REPLACE

  • If the types of the properties in the payload of the request do not respect the schema, the whole request will fail.

  • It is possible to define a hierarchy of inner objects while using @UpdateStrategyKey at each level

  • However, @UpdateStrategyKey should only be set to one property inside a given object

Limitations :

  • If a property in the schema has a directive such as @Property(path: “[parent].property”) (referencing [parent] in path) : this property cannot be updated with the partial update

  • Updatable properties cannot be computed values such as : computed field, ML function, results of function.

  • @UpdateValueObject cannot be used with @UpdateStrategyKey in the same object

FORCE_REPLACE

When importing user profiles using UPSERT, if you wish to update existing profiles by completely overwriting the existing profiles you should use the FORCE_REPLACE value of the update_strategy property: the user profile will be completely replaced by the object passed in the user_profile property.

Legacy parameters

property
type
description

force_replace

Boolean (Optional)

Mandatory when the operation is UPSERT. If true, then the User Profile will be completely replaced by the object passed in the user_profile field. If false, the object passed in the user_profile field will be merged with the existing User Profile of the UserPoint.

merge_objects

Boolean (Optional)

Only considered if force_replace is false.

Manage the comportement between two objects with a same property.

If false (default value), the new object overrides the existing one.

If true the new object is merged in deep to the existing one (see example).

More details on merge_objects behavior :

Last updated

Was this helpful?