Preserve variables

📘

Contact your CSM if you'd like to enable this feature for your app.

Once this feature is activated for your app, every variable that is synced via our SDK or API will be retained in the Leanplum content management system. We will no longer remove any variables missing or removed in one of your builds.

How it works

If you have an Android and iOS app, you can now create different variables between them, without worrying about a sync deleting any unused or missing variables.

So, if you run an Android build with var1, var2, var3 and then run an iPhone build with var3, var4, var5, the following will be stored: var1, var2,var3 (from the latest sync, which is from the iPhone), var4, and var5. If you run the Android build last, then the var3 value from Android will be stored.

The last value of a variable will always be used, so conflicts (between Android and iPhone) still require some care.

🚧

Note on arrays

With groups/arrays/lists, the most recent sync will completely overwrite the value of the variable. For example, if var3 above were a list with values 1, 2 and 3 in Android, but only value 1 in iPhone, the sync from the iPhone build would overwrite the value of this variable and var3 would only contain the value 1.

Delete a variable

Because variables are preserved, the only way to delete a variable is via our API. To delete variables, simply use the deleteVars call.

Arguments

parametertypedescription
appIdstringYour Leanplum app Id.
clientKeystringYour development key.
apiVersionstringThe version of our api. Use 1.0.6.
actionstringThe API action (deleteVars).
varslistA list of variables to remove.

Example:

POST /api?action=deleteVars 
{
  "appId": "YOUR_APP_ID",
  "clientKey": "YOUR_DEVELOPMENT_KEY",
  "apiVersion": "1.0.6",
  "vars": ["variableToDelete1", "variableToDelete2"]
}

Response:

{
  "response": [
    {
      "variablesRemoved": [
        "variableToDelete1",
        "variableToDelete2"
      ],
      "success": true
    }
  ]
}