On this page

getAnalyticsLogsPublishLog(data: GetAnalyticsLogsParams)

Requires:
@tuya-miniapp/cloud-api≥1.0.5

Description

Get issued-log history within a time range

Parameters

ParameterTypeRequiredDescription
YesRequest body

Return Value

Type: Promise<GetAnalyticsLogsResult>
Includes dps (DP result list), hasNext, and total; each dps element is DpResult (in the issued-log scenario, nickName and userName are included).

Referenced Types

typeGetAnalyticsLogsResultPaginated log results. The response examples also include a `dpc` field that is not individually documented in the return parameter table.
PropertyTypeDescription
dpsDpResult[]Device DP data collection
hasNextbooleanWhether there is a next page of data
totalnumberTotal record count

Examples

Request example

import { getAnalyticsLogsPublishLog } from '@tuya-miniapp/cloud-api';

getAnalyticsLogsPublishLog({
  devId: '6c272a8d82e3ed8300mizk',
  dpIds: '103,27',
  offset: 0,
  limit: 10,
})
  .then((response) => {
    console.log(response);
  })
  .catch();

Response example

{
  "dpc": [],
  "dps": [
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842723,
      "timeStr": "2023-10-09 17:12:03",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842722,
      "timeStr": "2023-10-09 17:12:02",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842722,
      "timeStr": "2023-10-09 17:12:02",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842720,
      "timeStr": "2023-10-09 17:12:00",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842720,
      "timeStr": "2023-10-09 17:12:00",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842720,
      "timeStr": "2023-10-09 17:12:00",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842719,
      "timeStr": "2023-10-09 17:11:59",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842719,
      "timeStr": "2023-10-09 17:11:59",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842719,
      "timeStr": "2023-10-09 17:11:59",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    },
    {
      "dpId": 27,
      "nickName": "86-155****1913",
      "timeStamp": 1696842718,
      "timeStr": "2023-10-09 17:11:58",
      "userName": "86-155****1913",
      "value": "0000003e8006600000000"
    }
  ],
  "hasNext": true,
  "total": 97815
}

Notes

  1. This API is a cloud capability and must be authorized before use. For details, see the cloud capability documentation. Cloud capabilities are not available in the Developer Tools environment; package the MiniApp or test on a real device.
  2. To upgrade device log storage and unlock more features, visit Device log value-added service. After upgrading, follow the activation process after subscribing to device log storage. With upgraded storage, this API can retrieve more logs.
  3. Commands sent through the Tuya MiniApp IDE virtual device plugin are not recorded in publish logs; only commands actually sent from a real client are recorded.