Understanding Date Formats in REST API v2 for Favorite Charts

Prev Next

Problem Statement

In the REST API v2, the date format for favorite charts varies based on the time frame that is set to pull the data. We see different Date formats for different time frames.

Example

if we pull the data for two favorite charts, one having time frame set as Daily and another having set as Monthly, we see different date formats in the response body for each of them.

Shorter time frames:
When querying for a shorter time frame, such as between "2023-01-01T01:00:00" and "2023-01-01T03:00:00", the response body adopts a more detailed date format as shown below:

{
  "id": 0,
  "name": "202301010100"
}

Here, the date and time information down to the hour level is included. This granularity in the date format is provided for precise data representation when dealing with shorter periods of time.

Longer time frames:
In contrast, when querying for a longer period, like "2023-01-01T00:00:00" to "2023-02-01T00:00:00", the response body adopts a simplified date format as shown below:

{
  "id": 0,
  "name": "20230101"
}

Conclusion

Notice for the longer timeframes (> 30 days),The hour information is omitted. This happens because the data for longer periods (>30 days)is aggregated by day.