Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guideDeveloper guideAdmin guide
Company siteHelp center
English
  • Русский
  • English
v72
  • v74
  • v73
  • v72
Login
  • User API documentation
  • API interaction
  • Matching
  • Profiles
    • Import profile
    • Update profile
    • Import multiple profiles
    • Update multiple profiles
    • Add multiple profiles
    • Add profile to database
    • Quick profile import
    • Import profile to RabbitMQ
    • Get profile data
    • Uploading profiles to a file
    • Suspend all database profiles
    • Unsuspend all profiles in a database
    • Delete profile
    • Subscription fields functional update
    • Database fields functional update
    • Merging multiple profiles
    • Unsubscribe profile from resource
    • Profile splitting
    • Subscriptions
    • Action history
    • Profile relations
    • Get data for multiple profiles
  • Databases
  • Resources
  • Segments
  • Static segments
  • Suppression lists
  • Templates and fragments
  • Campaigns
  • Automation scenarios
  • Promo codes
  • Goals
  • Application push notifications
  • Market
  • Analytic reports
  • SendersDevv71
  • External datatables queries
  • Objects
  • Miscellaneous
  • Importing the API collection in Postman
  • List of API endpoints
  • SDK
This is documentation for Altcraft Platform v72. This documentation is no longer maintained.
The information for up-to-date platform version at this page is available (v74).
  • Profiles
  • Database fields functional update
Documentation for version v72

Database fields functional update

When you use requests to update profile fields, you can include functions in field values.

A function here is a set of an operator and a value:

{
"action": "set",
"value": "x",
}

Action operator can be:

actionUsageField typevalue
setSet is a default operator for request parameters*Any field value
unsetDeletes a field from a profile (for all fields except email)*No value
incrIncreases field value. Integer type fields onlyint, floatInteger number
addAdds tags to a profile fieldtags, arr_objectArray of strings
deleteDeletes tags from a profile fieldtags, arr_objectArray of strings
upsertSets the value from the value field to the property specified in the submatch fieldobjectDepends on the field type
info

For object and arr_object data types, you must pass the value and submatch fields.

submatch is the path to the property whose value needs to be updated.

Request examples​

profiles/update increases one value and decreases the other. The same operator with different value sign is used:

  • JSON
  • XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 24,
"profile_id": "5a5b64a969d4265b958b9ac3",
"data": {
"checks": {
"action": "incr",
"value": 1000
},
"returns": {
"action": "incr",
"value": -1000
}
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<profile_id>6613c4754a5d12bd6cc0915f</profile_id>
<data>
<checks>
<action>incr</action>
<value>1000</value>
</checks>
<returns>
<action>incr</action>
<value>-1000</value>
</returns>
</data>
</xml>

profiles/update adds tags to profile "category" field:

  • JSON
  • XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"profile_id": "5a5b64a969d4265b958b9ac3",
"data": {
"category": {
"action": "add",
"value": [
"cars",
"cats"
]
}
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<profile_id>6613c4bf4a5d12bd6cc0916b</profile_id>
<data>
<category>
<action>add</action>
<value array='true'>cars</value>
<value>cats</value>
</category>
</data>
</xml>

An example of a profiles/update request that will update the "x" field in an object:

  • JSON
  • XML
{ 
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"profile_id": "6613c4bf4a5d12bd6cc0916b",
"data": {
"myObject": {
"action": "upsert",
"value": "y",
"submatch": "x"
}
}
}
<xml>
<token>2fefb577533d4cae919350c450755239</token>
<db_id>1</db_id>
<profile_id>66102b984a5d12bd6cc0912f</profile_id>
<data>
<myObject>
<action>upsert</action>
<value>y</value>
<submatch>x</submatch>
</myObject>
</data>
</xml>

profiles/update sets a new value for all elements of the object that contain the specified property (submatch):

Request​

  • JSON
  • XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"profile_id": "66102b984a5d12bd6cc0912f",
"data": {
"myObject": {
"action": "upsert",
"value": {
"x": "y",
"z": 1
},
"submatch": "x"
}
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<profile_id>66102b984a5d12bd6cc09132</profile_id>
<data>
<myObject>
<action>upsert</action>
<value>
<x>y</x>
<z>1</z>
</value>
<submatch>x</submatch>
</myObject>
</data>
</xml>

Object​

  • JSON
  • XML
{
{
"A": 1,
"x": false,
},
{
"B": "test"
},
{
"x": "test",
"C": true
}
}
<xml>
<value>
<A>1</A>
<x>false</x>
</value>
<value>
<B>test</a>
</value>
<value>
<x>test</x>
<c>true</c>
</value>
</xml>

Updated object​

  • JSON
  • XML
{
{
"A": 1,
"x": {"x": "y", "z": 1},
},
{
"B": "test"
},
{
"x": {"x": "y", "z": 1},
"C": true
}
}

<xml>
<value>
<A>1</A>
<x>
<m>y</m>
<z>1</z>
</x>
</value>
<value>
<B>test</B>
</value>
<value>
<x>
<m>y</m>
<z>1</z>
</x>
<c>true</c>
</value>
</xml>
info

If fields with type object and object_arr do not have a property that you want to change, this property is created automatically.

Last updated on May 12, 2024
Previous
Subscription fields functional update
Next
Merging multiple profiles
  • Request examples
    • Request
    • Object
    • Updated object
© 2015 - 2025 Altcraft, LLC. All rights reserved.