setDeviceAttributes

Sets device-level attributes, such as a deviceId or an iOS push token, for the current device. If the device is shared between multiple users, pass a userId with the deviceId to update the device for each user. (Passing just the deviceId will only update it once). If the device already exists, the attributes will be updated. If the device and user do not exist, a new user will be created along with this device (see the createDisposition option below). See selecting a user for more.

See Importing iOS push tokens for an example using setDeviceAttributes. This method requires your production API clientKey.

At least one of the following must be set to create/update a device: appVersion, systemName, systemVersion, browserName, browserVersion, deviceName, deviceModel, iosPushToken, gcmRegistrationId, or webPushSubscription.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
required
Defaults to YOUR_APP_ID

The application ID. To find yours, select your app in the navigation column, and click Manage Apps. Then click Keys & Settings.

string
required
Defaults to YOUR_PROD_KEY

The Production key for your Leanplum App.

string
enum
required
Defaults to 1.0.6

The version of the Leanplum API to use. The current version is 1.0.6.

Allowed:
string
required

The unique ID for the device.

string
Defaults to hfarnsworth

The current user ID. You can set this to whatever your company uses for user IDs. Leave it blank to use the device ID. For more info, see selecting a user.

string
enum
Defaults to CreateIfNeeded

The policy that determines whether users are created by the API. Possible values:

  • CreateIfNeeded creates a user with the given IDs if one does not already exist.
  • CreateNever requires that the user already exists, otherwise the API action is skipped and a warning will be returned.

The default value for this method is CreateIfNeeded.

Allowed:
boolean
Defaults to false

Whether the user is in Development Mode, i.e. the user associated with the request is a developer and not a user. This is important for reporting purposes. Default: false.

string

The version of the app used on this device. E.g. 2.0.1.

string

The name of the OS the current device is running. E.g. iOS.

string

The version number of the OS the current device is running. E.g. 6.0.

string

The name of the browser the current device is running. E.g. Chrome.

string

The version number of the browser the current device is running. E.g. 17.0.

string

A human-readable name representing the device.

string

The model name of the device. E.g. iPad.

string

The token used for Apple iOS push notifications on this device.

string

The registration ID used for Google Cloud Messaging push notifications on this device.

string

The JSON-encoded subscription used for web push notifications on this device.

Response

Language
Credentials
URL
LoadingLoading…
Response
Choose an example:
application/json