Device information

更新时间:
复制 MD 格式

Query device binding details, manufacturer information, and online status by user ID or device ID.

Query device information

Retrieves device information by user ID or device ID, including device binding details, manufacturer information, and the online status of Android devices.

Input parameters

Parameter

Type

Required

Example

Description

appId

String

Yes

ONEX570DA89211721

The application ID.

workspaceId

String

Yes

default

The workspace ID.

tenantId

String

Yes

LZFPEFIM

The tenant ID.

targetType

Integer

Yes

2

Query target type. Valid values:

  • 1: Device

  • 2: User

target

String

Yes

push_test_user

  • If targetType is 1, target is the device ID.

  • If targetType is 2, target is the user ID.

Output parameters

Parameter

Type

Example

Description

requestId

String

6FF637EA-D55D-1A4E-8443-DF28688E61B8

Request ID

success

Boolean

true

Whether the request was successful.

code

String

100

Result code

message

String

SUCCESS

Result message

data

Object

-

Response payload.

data

Parameter

Type

Example

Description

userId

String

push_test_user

User ID

deviceId

String

ae6f2a800196100080003030ac10010a396

Device ID

deliveryToken

String

ae6f2a800196100080003030ac10010a396

Self-built token

thirdToken

String

IQAAAACy0f7tAABYiMwLEENtr0TKYJEsv7wyu4Ubt9XXwTJAlknnCb1LAzB3wJvoZIcT_nJdaMhEoXJaqQrObAGHLGoU1GOexlTcLWzja-0HfGHKBw

Manufacturer token

platform

String

android

Device platform. Valid values:

  • android

  • ios

  • harmonyos

manufacturer

String

hms

Push channel manufacturer. Valid values:

  • unknown

  • android

  • ios

  • miui

  • hms

  • fcm

  • oppo

  • vivo

  • honor

  • harmonyos

statue

String

ONLINE

Device status. Defaults to UNKNOW for iOS and HarmonyOS.

  • ONLINE

  • OFFLINE

  • UNKNOW

Example

import com.alibaba.fastjson.JSON;
import com.aliyun.mpaas20201028.Client;
import com.aliyun.mpaas20201028.models.PushQueryDeviceStateRequest;
import com.aliyun.mpaas20201028.models.PushQueryDeviceStateResponse;
import com.aliyun.teaopenapi.models.Config;

public static void main(String[] args) throws Exception {
    // An Alibaba Cloud account AccessKey has full access permissions to all APIs. Use a Resource Access Management (RAM) user for API calls and daily O&M.
    // Do not hard-code your AccessKey ID and AccessKey secret in your project code. This can lead to an AccessKey leak and compromise the security of all resources in your account.
    // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
    // Configure the environment variables first.
    Config config = new Config();
    // Required. Your AccessKey ID.
    config.setAccessKeyId(System.getenv("MPAAS_AK_ENV"));
    // Required. Your AccessKey secret.
    config.setAccessKeySecret(System.getenv("MPAAS_SK_ENV"));
    // The REGION_ID and Endpoint for mPaaS. This example uses a non-Gold instance in Hangzhou.
    config.setRegionId("cn-hangzhou");
    config.setEndpoint("mpaas.cn-hangzhou.aliyuncs.com");
    Client client = new Client(config);

    PushQueryDeviceStateRequest request = new PushQueryDeviceStateRequest();
    request.setAppId("ONEX570DA89211721");
    request.setWorkspaceId("test");
    request.setTenantId("xxx");
    request.setTargetType(2);
    request.setTarget("push_test");
    PushQueryDeviceStateResponse pushQueryDeviceStateResponse = client.pushQueryDeviceState(request);
    System.out.println("response==>"+ JSON.toJSONString(pushQueryDeviceStateResponse));
}

Result codes

Result code

Result message

Description

100

SUCCESS

Success

3028

INVALID_PARAM

Invalid request parameters.

8011

FLOW_CONTROL_ERROR

Request throttled.

8012

INVALID_INSTANCE_ID

Invalid appId or workspaceId.

8013

INVALID_TENANT_ID

Invalid tenant ID.

8014

ACCOUNT_NO_PERMISSION

Insufficient permissions.

9000

SYSTEM_ERROR

Internal system error.