查询用户信息

批量查询用户的信息,包括用户标识、用户属性、设备属性、联系方式等。

  • 可以指定所需查询的信息字段
  • 1 次最多查询 100 个 EUID
  • 频控限制:单个项目下 1 分钟 1000 次

调用地址

POST /v1/user/profile

调用验证

EngageLab REST API 采用 HTTP 基本认证 的验证方式:HTTP Header(头)里加 Authorization:

Authorization: Basic ${base64_auth_string}
              
              Authorization: Basic ${base64_auth_string}

            
此代码块在浮窗中显示

上述 base64_auth_string 的生成算法为:base64(api_key:api_secret)

  • Header 名称是 "Authorization",值是 base64 转换过的 "username:password" 对(中间有个冒号)。
  • 在 MA API 的场景里,username 是 APIKey,password 是 APISecret。请在数据来源中添加 API 类型的数据源获得 APIKey 与 API Secret。

请求示例

请求头

> POST /v1/user/profile > Content-Type: application/json > Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==
              
              > POST /v1/user/profile
> Content-Type: application/json
> Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==

            
此代码块在浮窗中显示

请求体

{ "euid": [123456, 789012, 345678], "user_identities":["user_id", "anonymous_id", "registration_id"], "user_properties": ["el_utm_source", "el_utm_medium", "language"], "device_properties": ["el_platform", "el_app_version", "el_os"], "contacts": ["email", "mobile_phone", "landline_phone","whatsapp_phone"] }
              
              {
  "euid": [123456, 789012, 345678],
  "user_identities":["user_id", "anonymous_id", "registration_id"],
  "user_properties": ["el_utm_source", "el_utm_medium", "language"],
  "device_properties": ["el_platform", "el_app_version", "el_os"],
  "contacts": ["email", "mobile_phone", "landline_phone","whatsapp_phone"]
}

            
此代码块在浮窗中显示

请求参数

字段 类型 必填 描述
euid Array<Long> 用户 EUID 列表,长度限制 1-100 个
user_identities Array<String> 需要返回的用户标识字段列表。
- 不传/空数组返回全部
- 传具体字段:仅返回指定字段
-支持字段:"user_id", "anonymous_id", "registration_id"
user_properties Array<String> 需要返回的用户属性字段列表。
- 不传/空数组返回全部
- 传具体字段:仅返回指定字段
-支持字段:所有的用户属性字段
device_properties Array<String> 需要返回的设备属性字段列表。
- 不传/空数组返回全部
- 传具体字段:仅返回指定字段
注意el_registration_idel_last_active 始终返回
-支持字段:所有的设备属性字段-
contacts Array<String> 需要返回的联系方式字段列表。
- 不传/空数组返回全部
- 传具体字段:仅返回指定字段
-支持字段:"email", "mobile_phone", "landline_phone","whatsapp_phone"

返回参数

字段 类型 说明
code Integer 接口调用是否成功,0 表示成功或者部分成功,其他值代表失败
message String 接口调用结果描述,对返回码的说明,成功为 success
data Array<Object> 返回的 EUID 信息列表
euid Long 用户 EUID
user_identities Object 用户标识的信息
user_properties Object 用户属性的信息
device_properties Array<Object> 设备属性列表,按 el_last_active 降序排列
contacts Object 联系方式的信息
error_code Int EUID 的信息是否获取成功,0 代表成功,其他值代表失败

空值返回策略

  1. 查询的 Key 不存在:不返回该 Key
  2. 查询的 Key 存在但值为空或 null:返回该 Key,值保持空或 null
  3. 若查询的 EUID 不存在,所有查询的 Key 返回为 null,并在 error_code 中说明

全部成功

{ "code": 0, "message": "success", "data": [ { "euid": 123456, "user_identities":{ "user_id":"122", "anonymous_id":"", "registration_id":["190e35f7e01234567890"] }, "user_properties": { "language": "zh-CN" }, "device_properties": [ { "el_registration_id": "190e35f7e01234567890", "el_last_active": 1715413200000 } ], "contacts": {}, "error_code": 0 //对应的错误码,成功是为0,失败时有具体说明 } ] }
              
              {
    "code": 0,
    "message": "success",
    "data": [
        {
        "euid": 123456,
        "user_identities":{
            "user_id":"122",
            "anonymous_id":"",
            "registration_id":["190e35f7e01234567890"]
        }, 
        "user_properties": { 
            "language": "zh-CN" 
            },
        "device_properties": [
          {
            "el_registration_id": "190e35f7e01234567890",
            "el_last_active": 1715413200000
          }
        ],
        "contacts": {},
        "error_code": 0   //对应的错误码,成功是为0,失败时有具体说明
      }
    ]
}

            
此代码块在浮窗中显示

全部失败

{ "code": 55004, "message": "EUID count must be between 1 and 100" }
              
              {
  "code": 55004,
  "message": "EUID count must be between 1 and 100"
}

            
此代码块在浮窗中显示

部分成功

{ "code": 0, "message": "success", "data": [ { "euid": 123456, "user_identities":{ "user_id":"122", "anonymous_id":"", "registration_id":["190e35f7e01234567890"] }, "user_properties": { "language": "zh-CN" }, "device_properties": [ { "el_registration_id": "190e35f7e01234567890", "el_last_active": 1715413200000 } ], "contacts": {}, "error_code": 0 //对应的错误码,成功是为0,失败时有具体说明,例如 55108 }, { "euid": 1234567, "user_identities": null, "user_properties": null, "device_properties": null, "contacts": null, "error_code": 55108 //无效的 EUID } ] }
              
              {
    "code": 0,
    "message": "success",
    "data": [
        {
        "euid": 123456,
        "user_identities":{
            "user_id":"122",
            "anonymous_id":"",
            "registration_id":["190e35f7e01234567890"]
        }, 
        "user_properties": { 
            "language": "zh-CN" 
            },
        "device_properties": [
          {
            "el_registration_id": "190e35f7e01234567890",
            "el_last_active": 1715413200000
          }
        ],
        "contacts": {},
        "error_code": 0   //对应的错误码,成功是为0,失败时有具体说明,例如 55108
      },
      {
        "euid": 1234567,
        "user_identities": null,
        "user_properties": null,
        "device_properties": null,
        "contacts": null,
        "error_code": 55108   //无效的 EUID
      }
    ]
}

            
此代码块在浮窗中显示

错误码汇总

错误码 message 中文含义
55004 EUID count must be between 1 and 100Invalid request payload format等描述 参数不合法 / 参数校验失败,详见每一次的 Message 内容
55110 Too many requests, please try again later. 请求频率超限
40050 Authentication failed 接口鉴权失败
55000 System error 系统错误
55108 Invalid EUID 无效 EUID / EUID 不存在
Icon Solid Transparent White Qiyu
联系销售