Set User Attributes

Invocation Address

POST /v1/user/property

Invocation Verification

The EngageLab REST API uses HTTP Basic Authentication as the verification method. Add Authorization to the HTTP Header:

Authorization: Basic ${base64_auth_string}
              
              Authorization: Basic ${base64_auth_string}

            
This code block in the floating window

The base64_auth_string is generated using the following algorithm: base64(api_key:api_secret).

  • The header name is "Authorization", and the value is the base64-encoded "username:password" pair (separated by a colon).
  • For the MA API, the username corresponds to the APIKey, and the password corresponds to the APISecret. Please configure an API-type data source to obtain the APIKey and API Secret.

Request Example

Request Header

> POST /v1/user/property > Content-Type: application/json > Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==
              
              > POST /v1/user/property
> Content-Type: application/json
> Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==

            
This code block in the floating window

Request Body

{ "euid": 10362473, "type": "set", "properties": { "user_number_once": 46.2, // User property name and property value "user_string_once": "refef", "user_datetime_once": "2023-12-12 00:56:23" } }
              
              {
    "euid": 10362473,
    "type": "set",
    "properties": {
        "user_number_once": 46.2, // User property name and property value
        "user_string_once": "refef",
        "user_datetime_once": "2023-12-12 00:56:23"
    }
}

            
This code block in the floating window

Request Parameters

Field Type Required Description
euid Long Yes The unique user ID of EngageLab MA
type String Yes The operation type for updating the properties
  • set:Overwrite the property value
  • increase:For integer-type properties, increment the value by the reported data. If the property does not exist, the initial value is treated as 0
  • add:For list-type properties, append a value
  • remove:For list-type properties, remove a value
  • delete:Delete all values of the property
  • properties JSON Yes The list of user properties, where the key is the property name and the value is the property value

    Operation Types

    All properties in one request use the same type. Supported values are set, increase, add, remove, delete, setOnce, and update:

    Operation Applicable property types Description
    set All types Updates the value; an object_array value must be an array of objects and replaces the existing array.
    increase Number Adds the supplied number to the existing value; a missing property starts from 0.
    add List, object array Appends list elements with deduplication, or appends one object to an object array.
    remove List, object array Removes supplied list elements, or removes one object-array item by identifier.
    delete All types Deletes all values of the property.
    setOnce All types Writes only when the property has not been set.
    update Object array Partially updates one object-array item by identifier.

    Object Array Operations

    For an object_array property, the value for add is one JSON object and the value for set is an array of JSON objects. remove and update locate an item with $identifier_key and $identifier_value. The identifier field must be a defined string or number subfield of that property.

    The value for remove may contain only these identifier fields:

    { "euid": 10362473, "type": "remove", "properties": { "devices": { "$identifier_key": "device_id", "$identifier_value": "ios-001" } } }
                  
                  {
      "euid": 10362473,
      "type": "remove",
      "properties": {
        "devices": {
          "$identifier_key": "device_id",
          "$identifier_value": "ios-001"
        }
      }
    }
    
                
    This code block in the floating window

    update must also include a non-empty $new_object. $new_object cannot contain the identifier field; fields with a null value are removed from the matched item. The identifier must match exactly one array item.

    { "euid": 10362473, "type": "update", "properties": { "devices": { "$identifier_key": "device_id", "$identifier_value": "ios-001", "$new_object": { "model": "iPhone 16", "legacy_field": null } } } }
                  
                  {
      "euid": 10362473,
      "type": "update",
      "properties": {
        "devices": {
          "$identifier_key": "device_id",
          "$identifier_value": "ios-001",
          "$new_object": {
            "model": "iPhone 16",
            "legacy_field": null
          }
        }
      }
    }
    
                
    This code block in the floating window

    Return Parameters

    Field Type Required Description
    code Int Yes Indicates whether the interface call is successful. 0 means successful or partially successful, and other values represent failure
    message String Yes Result description of the API call, explaining the return code

    All Successful

    { "code": 0, "message": "success" }
                  
                  {
        "code": 0,
        "message": "success"
    }
    
                
    This code block in the floating window

    All Failed

    { "code": 55102, "message": "Invalid user attributes exist" }
                  
                  {
        "code": 55102,
        "message": "Invalid user attributes exist"
    }
    
                
    This code block in the floating window

    Error Code

    Code Description Detailed Explanation
    40050 Interface authentication failed. Confirm whether the project ID and project secret key are correct.
    40007 EUID is empty. Please check the value of EUID.
    50031 Project ID is invalid. Please check whether the APIKey and APISecret are correct.
    50034 Project ID does not exist. Please check whether the APIKey and APISecret are correct, and check whether the project has been deleted.
    50074 API data source does not exist. Please check whether the APIKey and APISecret are correct, and check whether the API data source has been deleted.
    55004 Business parameters are invalid. Please check whether the fields of the request parameters are correct.
    55101 The number of user identifiers exceeds the limit. Confirm whether the number of values of the user identification exceeds 100.
    55102 There are invalid user attribute names. Confirm whether the attribute name meets the naming requirements, and whether it is empty/uses reserved characters/exceeds the length limit.
    55103 User attribute values cannot be empty. Confirm whether the value of the user attribute in the request body is empty.
    55105 The value of the user identifier cannot exceed 256 characters. Confirm whether the value of the user identification exceeds 256 characters.
    55106 The name of the user identifier is not within the supported range. Confirm whether the name of the user identification is user_id, anonymous_id, or registration_id.
    55107 The value of the user identifier is empty. Confirm whether the value of the user identification in the request body is empty.
    55108 Invalid EUID. Please check the value of EUID.
    -1 Internal server error. Please contact EngageLab technical support.
    Icon Solid Transparent White Qiyu
    Contact Sales