Application Settings - Delete Variable

Delete Variable

Deletes an existing variable or data within a variable, this action cannot be undone!
Parameter NameDefault ValueRequiredDescription
application_idNULLTrueThe ID of the Application
secret_keyNULLTrueThe Application's Secret Key
access_tokenNULLFalseThe Access Token for the authenticated user
nameNULLTrueThe name of the variable to delete
byNULLFalseApplicable if you are deleting a value within a list/array variable, the acceptable values for this parameter are 'index' and 'key'
valueNULLFalseApplicable if you are deleting a value within a list/array variable, if you are deleting by 'index' then enter the index number (starting from 0), if you are deleting by 'key' then enter the key value
include_metafalseFalseIf you are deleting within a list/array, the results will return the value of the variable. If you would like to include the metadata then set this parameter to True or 1

Deleting a variable entirely

You can delete a variable entirely and the results will return a summary of all the variables you currently have set if the operation was successful, all you need to do is provide the name parameter which points to the variable you would like to delete.
{
  "success": true,
  "response_code": 200,
  "results": {
    "variables": {
      "int_test": {
        "type": "integer",
        "created_timestamp": 1608239452,
        "last_updated_timestamp": 1608239452,
        "size": 19
      }
    },
    "size": 29
  }
}
For more information about what the summary means see Application Settings - Get Summary

Deleting data within a variable

This is only applicable to list and array types, you can delete a value within a list or array but you need to specify what you want to delete.

Array example
{
  "foo": "bar",
  "bar": false,
  "lorem": 100
}
For this example, the variable name is array_example, and you would like delete "lorem" from this array. What you would need to do is set the by parameter to "key" and the value parameter to "lorem". You should get a response like this
{
  "success": true,
  "response_code": 200,
  "results": {
    "foo": "bar",
    "bar": false
  }
}

List example
[
  "foo",
  "bar",
  "lorem"
]
For this example, the variable name is list_example, and you would like delete "lorem" from this list. What you would need to do is set the by parameter to "index" and the value parameter to "2". You should get a response like this
{
  "success": true,
  "response_code": 200,
  "results": [
    "foo",
    "bar"
  ]
}

Example response when deleting data within a variable

When you delete a variable entirely then the response would be a summary of all the variables you currently have set, but when you delete data within a variable then the results will return the variable data itself.
{
  "success": true,
  "response_code": 200,
  "results": [
    "foo",
    "bar"
  ]
}

But if you pass on the include_meta parameter with it's value set to True or 1, then the results will include it's metadata
{
  "success": true,
  "response_code": 200,
  "results": {
    "type": "list",
    "value": [
      "foo",
      "bar"
    ],
    "created_timestamp": 1608243116,
    "last_updated_timestamp": 1608243116,
    "size": 27
  }
}

Metadata Results Structure

NameTypeDescription
typestringThe type of the variable
valuemixedThe value of the variable, the type for this can differ depending on the variable type
created_timestampintegerThe Unix Timestamp for when this variable was created
last_updated_timestampintegerThe Unix Timestamp for when this variable was last updated
sizeintegerThe size that this variable takes up (including it's metadata) in bytes