Get Report Data For Period
  • 29 Mar 2024
  • 4 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Get Report Data For Period

  • Dark
    Light
  • PDF

Article summary

/profiles/{Profile ID}/reports/{Report ID}/?period={Period} returns the report data for a given period.

Method: GET

URI: /profiles/{Profile ID}/reports/{Report ID}/?period={Period}

Note: Add any optional parameters to the end of the URI. If you change the order of URI or required parameters, or place optional parameters before them, the call will not work.

Version number

The version number you will use is dependant upon the version of Analytics you have installed. Analytics versions 9.5 and below, use v2_0. Analytics versions 9.5.1 and above will use v2_1.

Example Request
https://myDomain.com/{version}/ReportService/profiles/CxoSsHxKlF6/reports/42df19b6d9f2/?period=current_month&format=xml

Example Response

<?xml version="1.0" encoding="utf-8" ?> 
<DimensionalReport>
   <ReportDefinition name="definition">
     <decimal name="accountID">18079</decimal> 
     <string name="profileID">CxoSsHxKlF6</string> 
     <string name="ID">42df19b6d9f2</string> 
     <string name="name">Cities</string> 
     <boolean name="isRealtime">false</boolean> 
     <string name="type">dimensional</string> 
     <list name="properties">
        <boolean name="isHierarchy">false</boolean> 
        <boolean name="intervalsEnabled">false</boolean> 
        <boolean name="IsSearchable">true</boolean> 
        <string name="internalID">topcities</string> 
        <boolean name="IsRealTimeCompatible">true</boolean> 
        <null name="ProfileCategory" /> 
        <string name="totals">all</string> 
        <boolean name="ContainsRealtimeData">false</boolean> 
        <string name="LastUpdate">3/17/2009 0:10:08</string> 
        <string name="datasource">engine</string> 
        <string name="enginesearchtime">4031.25</string> 
     </list>
     <list name="measures">
        <Measure>
           <string name="name">Visits</string> 
           <string name="ID">Users-0</string> 
           <decimal name="columnID">0</decimal> 
           <boolean name="AllowTotals">true</boolean> 
           <boolean name="Sortable">false</boolean> 
        </Measure>
     </list>
   </ReportDefinition>
   <list name="data">
      <DataRow name="2009">
         <list name="measures">
         <float name="Visits">107538</float> 
   </list>
   <list name="SubRows">
      <DataRow name="Atlanta, Georgia, United States">
         <list name="measures">
            <float name="Visits">10600</float> 
         </list>
      </DataRow>
         <DataRow name="Sunnyvale, California, United States">    
            <list name="measures">
               <float name="Visits">10056</float> 
            </list>
         </DataRow>
         <DataRow name="Redmond, Washington, United States">
            <list name="measures">
               <float name="Visits">9466</float> 
            </list>
         </DataRow>
         <DataRow name="Portland, Oregon, United States">
            <list name="measures">
               <float name="Visits">7368</float> 
            </list>
         </DataRow>
         <DataRow name="Honolulu, Hawaii, United States">
            <list name="measures">
               <float name="Visits">1</float> 
            </list>
         </DataRow>
         <DataRow name="Everett, Washington, United States">
            <list name="measures">
               <float name="Visits">1</float> 
            </list>
         </DataRow>
         <DataRow name="Gonzales, Louisiana, United States">
            <list name="measures">
               <float name="Visits">1</float> 
            </list>
         </DataRow>
      </list>
      </DataRow>
    </list>
</DimensionalReport>

Parameters:

End period

Use the end_period parameter to specify the ending day of a date range. You must also supply the start_period.

end_period = ending day of date range

Example: specifying January 1, 2020 to January 30, 2020

start_period=2020m01d01&end_period=2020m01d30

Example: specifying the past 7 days (from yesterday)

start_period=current_day-7&end_period=current_day-1

Note: Several time period macros are available: CURRENT_DAY, CURRENT_MONTH and CURRENT_YEAR. Instead of a specific start and end date, you can identify relative time periods.

Format

format = return data format

Data formatParameter and value
JSONformat=json
XMLformat=xml
XML2 ("XPath-friendly" XML for dynamic applications)format=xml2
HTMLformat=html (use this when importing data into Excel)
CSVformat=csv (returned as a download)
RSSformat=rss (use to specify an RSS 2.0 syndication feed)
ATOMformat=atom (use to specify an ATOM 1.0 syndication feed)

For report data requests, all formats are supported. For "list" requests, only XML and JSON formats are supported.

Language

Use the language parameter with a language ID, such as en or locale ID, such as en-GB to specify language and locale preferences for translating and formatting dates and numbers in report data. (See ISO 639-1 and ISO-3166 for codes.)

The languages available are those that appear in the Analytics user interface as preferences:

Language preference being selected in the Analytics user interface.
language = language code[-dialect designator]

Strictly speaking, language=en_GB is a locale identifier for English-language speakers in Great Britain. (A hyphen is used to designate a dialect of a language, so the dialect for a resident of Great Britain is en-GB). In practice, however, due to the widespread lack of understanding of this distinction, "-" and "_" are treated as equivalent.

Period

Use the period parameter to specify the time period of interest and a trend length for report data. You can specify a relative time span or a specific time span (see here). Supplying only period is the same as supplying start_period and end_period with the same value.

period = time period * trend length

Example: getting data for a relative time period (current_day, current_month, current_year)

Time spanParameter and value
Yesterdayperiod=current_day-1
Two months agoperiod=current_month-2
Trending backward from February 28period=2024m02d28*28
Rolling 7-days-to-date trendperiod=current_day-1*7
Year trend with holidays and annual cyclical dataperiod=current_month-1*12

Example: getting data for a specific time span (year, quarter, month, week, day, hour)

Time spanParameter and value
2024period=2024
First quarter of 2024period=2024q01
January 2024period=2024m01
January, February and March 2024period=2024m03*3
23rd week of 2023period=2023w23
January 1, 2024period=2024m01d01
January 1, 2024 through January 6, 2024period=2024m01d06*6

Range

Use the range parameter to specify the start and end rows of the range of rows to return. If you specify only end row, start row defaults to 1. If you do not use this parameter, all rows are returned.

Note: The range parameter cannot be used in drill-down reports, since they contain a hierarchy of ranges.

range = start row * end row

Example: specifying ranges

RangeParameter and value
First 100 rowsrange=100
Rows 101 to 200range=101*200

Search

Use the search parameter for reports to return only records containing the search string in their dimension value.

search = search string

Example: creating a report with only the rows whose dimension value contains "DVD": search=DVD

Start period

Use the start_period parameter to specify the beginning day of a date range. You must also supply the end_period.

start_period = first day of date range

Example: specifying January 1, 2020 to January 30, 2020

start_period=2020m01d01&end_period=2020m01d30

Example: specifying the past 7 days (from yesterday)

start_period=current_day-7&end_period=current_day-1

Note: Several time period macros are available: CURRENT_DAY, CURRENT_MONTH and CURRENT_YEAR. Instead of a specific start and end date, you can identify relative time periods.

Suppress error codes

Set the suppress_error_codes parameter to true if you do not want to be notified of error conditions for a request (the default is false).

suppress_error_codes = {true|false}
Example: Suppress errors for a request
suppress_error_codes=true

Totals

The totals parameter specifies whether, or how, totals for measures are returned: all (default), only or none.

totals = {all | only | none}

Note: If you use the range or search parameter to return a subset of data, the totals returned are the subtotals for the entire period, rollup dimension, etc. For subsets of data, specify totals=none and use Excel to compute the totals.

What to returnParameter and value
No totalstotals=none
All totals (the default)totals=all
Only totalstotals=only

Was this article helpful?

What's Next