Expand my Community achievements bar.

SOLVED

Can I use dateRangeId instead of dateRange during POST /report?

Avatar

Level 1

I'm trying to run report with a daterange get from GET /daterange API

 

From Adobe Workspace debug mode I got this request, which include both dateRangeId and dateRange. But what if I only know dateRangeId? Or do I need to calculate dateRange by myself and send request with "dateRange" field?

 

{
    "rsid": "microstrategytech-stg",
    "globalFilters": [
        {
            "type": "dateRange",
            "dateRange": "2025-01-01T00:00:00.000/2025-02-01T00:00:00.000",
            "dateRangeId": "lastFullMonth"
        }
    ],
    "metricContainer": {
        "metrics": [
            {
                "columnId": "0",
                "id": "metrics/occurrences",
                "sort": "desc"
            }
        ]
    },
    "dimension": "variables/browser",
    ...........
}
 
Besides, I found that if I add expansion=definition during GET /daterange, I cound get daterange with definition like:

today: td/td+1d

last90Days: td-89d/td+1d

thisWeek: tw/tw+1w

lastFullWeek: tw-1w/tw

thisMonth: tm/tm+1m

threeMonthsAgo: tm-3m/tm-2m

thisYear: ty/ty+1y

thisQuarter: tq/tq+1q

custom date range could be like: 2025-01-01T00:00:00/2025-03-01T23:59:59

 

But I didn't find a document explaining all keyword of daterange definition. Are td/tw/tm/ty/tq/d/w/m/y/q all the keywords for daterange definition?

Non of the following docs explains detailed daterange definition.

https://github.com/AdobeDocs/analytics-2.0-apis/blob/master/dateranges.md

https://adobedocs.github.io/analytics-2.0-apis/

https://developer.adobe.com/analytics-apis/docs/2.0/guides/endpoints/date-ranges/

 

Thanks!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi @qiuwu ,

Please note that both dateRangeId and dateRange attributes are optional. The dateRangeId works as a label for your global filter and does not impact the reporting period used for the report, that is controlled via dateRange attribute only.

If you want to return data for a specific period dateRange attribute needs to be manually calculated and populated even for preset Date Range IDs like thisMonth. You run a report without dateRange also as long as you have settings.includeAnnotations property either set to false or not populated, in this case the report will use the default reporting period as Last 90 Days. If settings.includeAnnotations property is set to true then you'd need to add dateRange field is required. 

Regarding the date abbreviations, these can be read as below,

  • td: Start of current day
  • tw: Start of current week
  • tm: Start of current month
  • ty: Start of current year
  • tq: Start of current quarter
  • d: day
  • w: week
  • m: month
  • y: year
  • q: quarter

Using these you can calculate start and end of any date range as below example,

  • This week: Week Start = tw | Week End = tw+1w
  • This month: Month Start = tm | Month End = tm+1m

The closest reference to these abbreviations that I could find is Date references in Adobe Report Builder documentation. As this is also an API based tool you can use the information shared here.

Cheers!

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi @qiuwu ,

Please note that both dateRangeId and dateRange attributes are optional. The dateRangeId works as a label for your global filter and does not impact the reporting period used for the report, that is controlled via dateRange attribute only.

If you want to return data for a specific period dateRange attribute needs to be manually calculated and populated even for preset Date Range IDs like thisMonth. You run a report without dateRange also as long as you have settings.includeAnnotations property either set to false or not populated, in this case the report will use the default reporting period as Last 90 Days. If settings.includeAnnotations property is set to true then you'd need to add dateRange field is required. 

Regarding the date abbreviations, these can be read as below,

  • td: Start of current day
  • tw: Start of current week
  • tm: Start of current month
  • ty: Start of current year
  • tq: Start of current quarter
  • d: day
  • w: week
  • m: month
  • y: year
  • q: quarter

Using these you can calculate start and end of any date range as below example,

  • This week: Week Start = tw | Week End = tw+1w
  • This month: Month Start = tm | Month End = tm+1m

The closest reference to these abbreviations that I could find is Date references in Adobe Report Builder documentation. As this is also an API based tool you can use the information shared here.

Cheers!

Avatar

Level 1

@Harveer_SinghGi1 Thanks so much for your reply!