How to Apply Historical Date Filters in OpenAPI Queries within Odata
search cancel

How to Apply Historical Date Filters in OpenAPI Queries within Odata

book

Article ID: 403730

calendar_today

Updated On:

Products

Network Observability

Issue/Introduction

This article explains how to apply historical date filters using the startTime and endTime parameters in OpenAPI queries for DX NetOps Performance Management. It includes example queries, retention period details, and how to incorporate business hours and time zone filters.

Environment

DX NetOps Performance Management 24.3.x

Resolution

How to Apply a Specific Time Range

To filter historical data in OpenAPI queries:

  • Use startTime to define when your data range begins
  • Use endTime to define when your data range ends

Note: These parameters must be expressed as UNIX timestamps in milliseconds (UTC-based).

Sample Query

http://da_hostname:8581/odata/api/groups?
$apply=groupby(portmfs/ID, aggregate(portmfs(im_Utilization with average as Value)))&
resolution=RATE&
startTime=1672531200000&
endTime=1672617599000&
$select=ID,Name

Explanation:

startTime=1672531200000 → 2023-01-01 00:00:00 UTC

endTime=1672617599000 → 2023-01-01 23:59:59 UTC

Use a Unix timestamp converter to get accurate time ranges.

How Far Back Can You Query?

Data retention depends on the configured settings. The typical defaults are:

Raw data: ~45 days

Hourly roll-ups: ~3 months

Daily roll-ups: 1 year or more

For more details, refer to the official documentation:
👉 Data Retention Rates - Broadcom Tech Docs

Using Business Hours and Time Zone Filters

You can further refine queries by limiting results to specific business hours and time zones.

Additional Parameters:

period=1w → limits to the last week

bh=Mon-Fri 9:00-17:00 → restricts results to business hours

tz=-05 → sets time zone to EST (UTC-5)

Example Combined Query

http://da_hostname:8581/odata/api/groups?
$apply=groupby(portmfs/ID, aggregate(portmfs(im_Utilization with average as Value)))&
resolution=RATE&
startTime=1672531200000&
endTime=1672617599000&
bh=Mon-Fri 9:00-17:00&
tz=+01&
$select=ID,Name

What This Does:

  • Retrieves average utilization
  • For specific ports
  • On January 1, 2023
  • During business hours only
  • In CET time zone (UTC+1)

Advanced Example with Graph Data:

Here's a more advanced query example, often used for populating dashboard graphs:

https://DA:8582/odata/api/portmfs?
$apply=groupby(ID, aggregate(
  im_UtilizationIn with percentile95 as Value,
  im_UtilizationOut with average as Value1,
  im_UtilizationIn with average as Value2,
  im_UtilizationOut with percentile95 as Value3,
  im_DiscardsOut with average as Value4,
  im_DiscardsIn with average as Value5))&&
resolution=RATE&
period=4h&
$expand=interface,device&
$select=interface/ID,interface/Alias,interface/Name,device/Name,device/ID,device/HostName,ID,Value,Value1,Value2,Value3,Value4,Value5

Summary

Parameter     Description
startTime       Start of the desired time range (in ms)
endTime        End of the desired time range (in ms)
period            Predefined rolling time window (e.g., 1w)
bh                  Business hours filter (e.g., Mon-Fri 9:00-17:00)
tz                   Time zone offset (e.g., -05 for EST)