Updates a device with custom attributes

This endpoint updates a device with new attributes, merging (not replacing) the attributes you sent in the request with the ones present on the device record.

Note that if sent a mix invalid data (keys other than user_email, user_id, user_attributes or tags, or invalid values for any of the above) and valid data, we'll take the valid data and discard the invalid. If only invalid data is sent, however, we'll return a 422 response.

Valid Types

Data type

Ranges/valid values

Example

Notes

Can be sent as array

integer

-2,147,483,647 to 2,147,483,647

12, 24, 25

Floating point numbers are accepted but they will be truncated to an integer. If you wish to keep the decimal part, use float instead.

Values out of range will be discarded.

Yes

float

Single-precision 32-bit IEEE 754 floating point.

12.343, 123.33

Floats greater than 32-bit will be converted to scientific notation.

Yes

string

UTF-8 character encoding

Cody, gold, A string with a , comma

Maximum 255 characters long

Yes

date

ISO 8601, e.g. YYYY-MM-ddTHH:mm:ssZ

2017-02-06T18:25:32+0300

Yes

boolean

true or false

No

User Attributes Hash Structure

User Attributes - sometimes called Custom Attributes - have a specific structure that must be user when setting them via the Sailthru Mobile API. Below is an annotated example:

{
  "device": {
    "user_attributes": { // Hash containing all the attributes we want to set
      "first_name": { // The name of the attribute
        "type": "string", // Attribute type as described above
        "value": "Cody" // The actual value of the attribute
      },
      "last_name": {
        "type": "string",
        "value": "Buena"
      }
      // + as many as 48 other attributes you want to set
    }
  }
}

Custom Attribute Limits

There are limits in place on the maximum number of custom attributes allowed as well as the length (size) of strings and arrays.

  • A maximum of 50 custom attributes is allowed per device. If you exceed this amount any new attributes being set will be discarded.
  • String values that have more than 255 characters will be truncated. The limitation is on the character length, not on the size in bytes.
  • Arrays with more than 50 elements will be truncated.

Key Name Restrictions

There are some restrictions in place on the key name, these are:

  • Only letters, numbers, underscore and dash are valid characters.
  • Leading spaces will be removed. " my_string_key " will become "my_string_key".
  • Invalid characters other than spaces and dots will be removed. "my_string_key~~~~" will become "my_string_key".
  • Spaces and dots will be replaced for underscores. "my string.key" will become "my_string_key".
  • Keys will be truncated to a maximum of 255 characters.
  • Invalid keys (including keys exclusively made of invalid characters) will simply be discarded and no error will be returned.
Language
Authentication
Basic
base64
: