---
name: "getLogInSpecifiedTime"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.5.2" }
title: "getLogInSpecifiedTime - Get DP Logs for Specified Time Period"
---

## getLogInSpecifiedTime

> [VERSION] @ray-js/ray >= 1.5.2

### Description

Get DP reporting logs within a specified time range (supports pagination)

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `IGetLogInSpecifiedTime` | Yes | Request parameters |

### Return Value

Type: `Promise<IGetLogInSpecifiedTimeResponse>`

Log data, including total count, DP log list, and whether there is a next page

### Referenced Types

##### `interface` IGetLogInSpecifiedTime

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `devId` | `string` | Yes | Device ID |
| `dpIds` | `string` | Yes | DP IDs, separated by commas |
| `offset` | `number` | Yes | Pagination offset |
| `limit` | `number` | Yes | Page size, up to 1000 |
| `sortType` | `"DESC" \| "ASC"` | No | Sort order: 'DESC' descending (default) or 'ASC' ascending |
| `startTime` | `string` | No | Query start timestamp (ms) |
| `endTime` | `string` | No | End timestamp for the query (ms) |


### Valid Values

##### `IGetLogInSpecifiedTime.sortType`

| Value | Description | Since |
| --- | --- | --- |
| `DESC` | - | - |
| `ASC` | - | - |


### Examples

#### Basic usage

```ts
import { getLogInSpecifiedTime } from '@ray-js/ray';

getLogInSpecifiedTime({
  devId: 'vdevo169477319679442',
  dpIds: '1,2',
  offset: 0,
  limit: 50,
  startTime: '1620000000000',
  endTime: '1629999999999',
  sortType: 'DESC',
}).then((res) => {
  console.log('Log data:', res);
}).catch((error) => {
  console.error(error);
});
```
