google-analytics-api Reporting API (Analytics v4) Single Report Example Rest


Example

API requests are HTTP POST with the access token attached at the end of the API end point.

Authorization Requires one of the following OAuth scopes:

Note when posting the data use ContentType = "application/Json";

https://analyticsreporting.googleapis.com/v4/reports:batchGet?Access_token={from auth}
{
  "reportRequests":[
  {
    "viewId":"XXXX",
    "dateRanges":[
      {
        "startDate":"2015-06-15",
        "endDate":"2015-06-30"
      }],
    "metrics":[
      {
        "expression":"ga:sessions"
      }],
    "dimensions": [
      {
        "name":"ga:browser"
      }]
    }]
}