Device Data API

Overview

Device API helps to

  • Create a new device profile
  • Update profile data of an existing device.

Device API attributes include customer_id (Identifier of User), device_id (Identifier of Device), and other Device Attributes such as model, brand, os version, and so on.

Endpoints

Data Center Name Device Data Endpoint
Data Center 1 (DC-01) https://api-01.moengage.com/v1/device/
Data Center 2 (DC-02) https://api-02.moengage.com/v1/device/
Data Center 3 (DC-03) https://api-03.moengage.com/v1/device/

For more information about MoEngage data centers, refer to Data Centers in MoEngage.

Syntax

Text

POST https://api-01.moengage.com/v1/device/<APP ID>
POST https://api-02.moengage.com/v1/device/<APP ID>
POST https://api-03.moengage.com/v1/device/<APP ID>

Request Body

A sample API request body is as follows:

JSON
{
  "type": "device",
  "customer_id": "john@example.com",
  "device_id" : "96bd03b6-defc-4203-83d3-dc1c73080232",
  "attributes": {
    "model": "iPhone",
    "platform" : "iOS",
    "push_preference" : "true",
    "push_id" : "irBMohQPf_k2QrwP8iRzK3A/0CdLEzAoVGdF65HhH_I",
    "app_version" : "10.1",
    "os_version" : "2.5.4",
    "active" : "true",
    "created_time" : 143383676
  }
}

Updating existing devices in MoEngage

For devices created by MoEngage SDK, device_id is internal and is not available for use externally.

You cannot update the device profiles created by MoEngage SDK. You can only create new device profiles and associate them to the appropriate user profile by

  • Providing the correct customer_id
  • Update the device profiles created by you by using the appropriate device_ids in the request.

Request Body Fields

Key Datatype Mandatory Field Description
type String Yes Identify the request type.
customer_id String Yes Identifier to identify or create a user in MoEngage.
device_id String No Identify specific devices in MoEngage. If this field is not present, MoEngage will create a new device.
attributes JSON Object No Dictionary containing device attributes to add or update in the device profile.
platform String Yes Platform is the type of device required to run push and in-app campaigns. Allowed values are ANDROID, iOS or web.
push_id String Yes Push Id or Push Token used to send a push notification to the device.

Standard User Attributes

The following standard user attributes are tracked for Device API in MoEngage.

Key Datatype Description
model String Model of Device
push_preference Boolean If push notifications are enabled for this device
app_version String App version of the app currently present on this device.
os_version String OS version of the device
active Boolean If the app is currently active (installed) on this device or not.
created_time Numeric (Epoch time in seconds) Time when this device was created.
 

Using Device Attributes in MoEngage

Device attributes are only visible in the MoEngage Analytics module and not visible on the dashboard for Segmentation, Campaigns and User Profile.

For other attributes not part of the list, use the key-value pairs that you intend to use. For example, to set the brand attribute for the device to Apple

JSON
{
  "type": "device",
  "customer_id": "john@example.com",
  "device_id" : "96bd03b6-defc-4203-83d3-dc1c73080232",
  "attributes": {
    "brand": "Apple",
    "platform": "iOS",
    "push_id": "irBMohQPf_k2QrwP8iRzK3A/0CdLEzAoVGdF65HhH_I"
  }
}
 

Reserved keywords for the user attribute name

"id", "_id", and "" keywords are blocked and do not use as user attribute names.

 

Was this article helpful?
0 out of 0 found this helpful