Analytics Reporting API
POST
analyticsreporting.reports.batchGet
{{baseUrl}}/v4/reports:batchGet
BODY json
{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/reports:batchGet");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v4/reports:batchGet" {:content-type :json
:form-params {:reportRequests [{:cohortGroup {:cohorts [{:dateRange {:endDate ""
:startDate ""}
:name ""
:type ""}]
:lifetimeValue false}
:dateRanges [{}]
:dimensionFilterClauses [{:filters [{:caseSensitive false
:dimensionName ""
:expressions []
:not false
:operator ""}]
:operator ""}]
:dimensions [{:histogramBuckets []
:name ""}]
:filtersExpression ""
:hideTotals false
:hideValueRanges false
:includeEmptyRows false
:metricFilterClauses [{:filters [{:comparisonValue ""
:metricName ""
:not false
:operator ""}]
:operator ""}]
:metrics [{:alias ""
:expression ""
:formattingType ""}]
:orderBys [{:fieldName ""
:orderType ""
:sortOrder ""}]
:pageSize 0
:pageToken ""
:pivots [{:dimensionFilterClauses [{}]
:dimensions [{}]
:maxGroupCount 0
:metrics [{}]
:startGroup 0}]
:samplingLevel ""
:segments [{:dynamicSegment {:name ""
:sessionSegment {:segmentFilters [{:not false
:sequenceSegment {:firstStepShouldMatchFirstHit false
:segmentSequenceSteps [{:matchType ""
:orFiltersForSegment [{:segmentFilterClauses [{:dimensionFilter {:caseSensitive false
:dimensionName ""
:expressions []
:maxComparisonValue ""
:minComparisonValue ""
:operator ""}
:metricFilter {:comparisonValue ""
:maxComparisonValue ""
:metricName ""
:operator ""
:scope ""}
:not false}]}]}]}
:simpleSegment {:orFiltersForSegment [{}]}}]}
:userSegment {}}
:segmentId ""}]
:viewId ""}]
:useResourceQuotas false}})
require "http/client"
url = "{{baseUrl}}/v4/reports:batchGet"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v4/reports:batchGet"),
Content = new StringContent("{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/reports:batchGet");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/reports:batchGet"
payload := strings.NewReader("{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v4/reports:batchGet HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 3681
{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v4/reports:batchGet")
.setHeader("content-type", "application/json")
.setBody("{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/reports:batchGet"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/reports:batchGet")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v4/reports:batchGet")
.header("content-type", "application/json")
.body("{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}")
.asString();
const data = JSON.stringify({
reportRequests: [
{
cohortGroup: {
cohorts: [
{
dateRange: {
endDate: '',
startDate: ''
},
name: '',
type: ''
}
],
lifetimeValue: false
},
dateRanges: [
{}
],
dimensionFilterClauses: [
{
filters: [
{
caseSensitive: false,
dimensionName: '',
expressions: [],
not: false,
operator: ''
}
],
operator: ''
}
],
dimensions: [
{
histogramBuckets: [],
name: ''
}
],
filtersExpression: '',
hideTotals: false,
hideValueRanges: false,
includeEmptyRows: false,
metricFilterClauses: [
{
filters: [
{
comparisonValue: '',
metricName: '',
not: false,
operator: ''
}
],
operator: ''
}
],
metrics: [
{
alias: '',
expression: '',
formattingType: ''
}
],
orderBys: [
{
fieldName: '',
orderType: '',
sortOrder: ''
}
],
pageSize: 0,
pageToken: '',
pivots: [
{
dimensionFilterClauses: [
{}
],
dimensions: [
{}
],
maxGroupCount: 0,
metrics: [
{}
],
startGroup: 0
}
],
samplingLevel: '',
segments: [
{
dynamicSegment: {
name: '',
sessionSegment: {
segmentFilters: [
{
not: false,
sequenceSegment: {
firstStepShouldMatchFirstHit: false,
segmentSequenceSteps: [
{
matchType: '',
orFiltersForSegment: [
{
segmentFilterClauses: [
{
dimensionFilter: {
caseSensitive: false,
dimensionName: '',
expressions: [],
maxComparisonValue: '',
minComparisonValue: '',
operator: ''
},
metricFilter: {
comparisonValue: '',
maxComparisonValue: '',
metricName: '',
operator: '',
scope: ''
},
not: false
}
]
}
]
}
]
},
simpleSegment: {
orFiltersForSegment: [
{}
]
}
}
]
},
userSegment: {}
},
segmentId: ''
}
],
viewId: ''
}
],
useResourceQuotas: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v4/reports:batchGet');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/reports:batchGet',
headers: {'content-type': 'application/json'},
data: {
reportRequests: [
{
cohortGroup: {
cohorts: [{dateRange: {endDate: '', startDate: ''}, name: '', type: ''}],
lifetimeValue: false
},
dateRanges: [{}],
dimensionFilterClauses: [
{
filters: [
{
caseSensitive: false,
dimensionName: '',
expressions: [],
not: false,
operator: ''
}
],
operator: ''
}
],
dimensions: [{histogramBuckets: [], name: ''}],
filtersExpression: '',
hideTotals: false,
hideValueRanges: false,
includeEmptyRows: false,
metricFilterClauses: [
{
filters: [{comparisonValue: '', metricName: '', not: false, operator: ''}],
operator: ''
}
],
metrics: [{alias: '', expression: '', formattingType: ''}],
orderBys: [{fieldName: '', orderType: '', sortOrder: ''}],
pageSize: 0,
pageToken: '',
pivots: [
{
dimensionFilterClauses: [{}],
dimensions: [{}],
maxGroupCount: 0,
metrics: [{}],
startGroup: 0
}
],
samplingLevel: '',
segments: [
{
dynamicSegment: {
name: '',
sessionSegment: {
segmentFilters: [
{
not: false,
sequenceSegment: {
firstStepShouldMatchFirstHit: false,
segmentSequenceSteps: [
{
matchType: '',
orFiltersForSegment: [
{
segmentFilterClauses: [
{
dimensionFilter: {
caseSensitive: false,
dimensionName: '',
expressions: [],
maxComparisonValue: '',
minComparisonValue: '',
operator: ''
},
metricFilter: {
comparisonValue: '',
maxComparisonValue: '',
metricName: '',
operator: '',
scope: ''
},
not: false
}
]
}
]
}
]
},
simpleSegment: {orFiltersForSegment: [{}]}
}
]
},
userSegment: {}
},
segmentId: ''
}
],
viewId: ''
}
],
useResourceQuotas: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/reports:batchGet';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"reportRequests":[{"cohortGroup":{"cohorts":[{"dateRange":{"endDate":"","startDate":""},"name":"","type":""}],"lifetimeValue":false},"dateRanges":[{}],"dimensionFilterClauses":[{"filters":[{"caseSensitive":false,"dimensionName":"","expressions":[],"not":false,"operator":""}],"operator":""}],"dimensions":[{"histogramBuckets":[],"name":""}],"filtersExpression":"","hideTotals":false,"hideValueRanges":false,"includeEmptyRows":false,"metricFilterClauses":[{"filters":[{"comparisonValue":"","metricName":"","not":false,"operator":""}],"operator":""}],"metrics":[{"alias":"","expression":"","formattingType":""}],"orderBys":[{"fieldName":"","orderType":"","sortOrder":""}],"pageSize":0,"pageToken":"","pivots":[{"dimensionFilterClauses":[{}],"dimensions":[{}],"maxGroupCount":0,"metrics":[{}],"startGroup":0}],"samplingLevel":"","segments":[{"dynamicSegment":{"name":"","sessionSegment":{"segmentFilters":[{"not":false,"sequenceSegment":{"firstStepShouldMatchFirstHit":false,"segmentSequenceSteps":[{"matchType":"","orFiltersForSegment":[{"segmentFilterClauses":[{"dimensionFilter":{"caseSensitive":false,"dimensionName":"","expressions":[],"maxComparisonValue":"","minComparisonValue":"","operator":""},"metricFilter":{"comparisonValue":"","maxComparisonValue":"","metricName":"","operator":"","scope":""},"not":false}]}]}]},"simpleSegment":{"orFiltersForSegment":[{}]}}]},"userSegment":{}},"segmentId":""}],"viewId":""}],"useResourceQuotas":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/reports:batchGet',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "reportRequests": [\n {\n "cohortGroup": {\n "cohorts": [\n {\n "dateRange": {\n "endDate": "",\n "startDate": ""\n },\n "name": "",\n "type": ""\n }\n ],\n "lifetimeValue": false\n },\n "dateRanges": [\n {}\n ],\n "dimensionFilterClauses": [\n {\n "filters": [\n {\n "caseSensitive": false,\n "dimensionName": "",\n "expressions": [],\n "not": false,\n "operator": ""\n }\n ],\n "operator": ""\n }\n ],\n "dimensions": [\n {\n "histogramBuckets": [],\n "name": ""\n }\n ],\n "filtersExpression": "",\n "hideTotals": false,\n "hideValueRanges": false,\n "includeEmptyRows": false,\n "metricFilterClauses": [\n {\n "filters": [\n {\n "comparisonValue": "",\n "metricName": "",\n "not": false,\n "operator": ""\n }\n ],\n "operator": ""\n }\n ],\n "metrics": [\n {\n "alias": "",\n "expression": "",\n "formattingType": ""\n }\n ],\n "orderBys": [\n {\n "fieldName": "",\n "orderType": "",\n "sortOrder": ""\n }\n ],\n "pageSize": 0,\n "pageToken": "",\n "pivots": [\n {\n "dimensionFilterClauses": [\n {}\n ],\n "dimensions": [\n {}\n ],\n "maxGroupCount": 0,\n "metrics": [\n {}\n ],\n "startGroup": 0\n }\n ],\n "samplingLevel": "",\n "segments": [\n {\n "dynamicSegment": {\n "name": "",\n "sessionSegment": {\n "segmentFilters": [\n {\n "not": false,\n "sequenceSegment": {\n "firstStepShouldMatchFirstHit": false,\n "segmentSequenceSteps": [\n {\n "matchType": "",\n "orFiltersForSegment": [\n {\n "segmentFilterClauses": [\n {\n "dimensionFilter": {\n "caseSensitive": false,\n "dimensionName": "",\n "expressions": [],\n "maxComparisonValue": "",\n "minComparisonValue": "",\n "operator": ""\n },\n "metricFilter": {\n "comparisonValue": "",\n "maxComparisonValue": "",\n "metricName": "",\n "operator": "",\n "scope": ""\n },\n "not": false\n }\n ]\n }\n ]\n }\n ]\n },\n "simpleSegment": {\n "orFiltersForSegment": [\n {}\n ]\n }\n }\n ]\n },\n "userSegment": {}\n },\n "segmentId": ""\n }\n ],\n "viewId": ""\n }\n ],\n "useResourceQuotas": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v4/reports:batchGet")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/reports:batchGet',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
reportRequests: [
{
cohortGroup: {
cohorts: [{dateRange: {endDate: '', startDate: ''}, name: '', type: ''}],
lifetimeValue: false
},
dateRanges: [{}],
dimensionFilterClauses: [
{
filters: [
{
caseSensitive: false,
dimensionName: '',
expressions: [],
not: false,
operator: ''
}
],
operator: ''
}
],
dimensions: [{histogramBuckets: [], name: ''}],
filtersExpression: '',
hideTotals: false,
hideValueRanges: false,
includeEmptyRows: false,
metricFilterClauses: [
{
filters: [{comparisonValue: '', metricName: '', not: false, operator: ''}],
operator: ''
}
],
metrics: [{alias: '', expression: '', formattingType: ''}],
orderBys: [{fieldName: '', orderType: '', sortOrder: ''}],
pageSize: 0,
pageToken: '',
pivots: [
{
dimensionFilterClauses: [{}],
dimensions: [{}],
maxGroupCount: 0,
metrics: [{}],
startGroup: 0
}
],
samplingLevel: '',
segments: [
{
dynamicSegment: {
name: '',
sessionSegment: {
segmentFilters: [
{
not: false,
sequenceSegment: {
firstStepShouldMatchFirstHit: false,
segmentSequenceSteps: [
{
matchType: '',
orFiltersForSegment: [
{
segmentFilterClauses: [
{
dimensionFilter: {
caseSensitive: false,
dimensionName: '',
expressions: [],
maxComparisonValue: '',
minComparisonValue: '',
operator: ''
},
metricFilter: {
comparisonValue: '',
maxComparisonValue: '',
metricName: '',
operator: '',
scope: ''
},
not: false
}
]
}
]
}
]
},
simpleSegment: {orFiltersForSegment: [{}]}
}
]
},
userSegment: {}
},
segmentId: ''
}
],
viewId: ''
}
],
useResourceQuotas: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/reports:batchGet',
headers: {'content-type': 'application/json'},
body: {
reportRequests: [
{
cohortGroup: {
cohorts: [{dateRange: {endDate: '', startDate: ''}, name: '', type: ''}],
lifetimeValue: false
},
dateRanges: [{}],
dimensionFilterClauses: [
{
filters: [
{
caseSensitive: false,
dimensionName: '',
expressions: [],
not: false,
operator: ''
}
],
operator: ''
}
],
dimensions: [{histogramBuckets: [], name: ''}],
filtersExpression: '',
hideTotals: false,
hideValueRanges: false,
includeEmptyRows: false,
metricFilterClauses: [
{
filters: [{comparisonValue: '', metricName: '', not: false, operator: ''}],
operator: ''
}
],
metrics: [{alias: '', expression: '', formattingType: ''}],
orderBys: [{fieldName: '', orderType: '', sortOrder: ''}],
pageSize: 0,
pageToken: '',
pivots: [
{
dimensionFilterClauses: [{}],
dimensions: [{}],
maxGroupCount: 0,
metrics: [{}],
startGroup: 0
}
],
samplingLevel: '',
segments: [
{
dynamicSegment: {
name: '',
sessionSegment: {
segmentFilters: [
{
not: false,
sequenceSegment: {
firstStepShouldMatchFirstHit: false,
segmentSequenceSteps: [
{
matchType: '',
orFiltersForSegment: [
{
segmentFilterClauses: [
{
dimensionFilter: {
caseSensitive: false,
dimensionName: '',
expressions: [],
maxComparisonValue: '',
minComparisonValue: '',
operator: ''
},
metricFilter: {
comparisonValue: '',
maxComparisonValue: '',
metricName: '',
operator: '',
scope: ''
},
not: false
}
]
}
]
}
]
},
simpleSegment: {orFiltersForSegment: [{}]}
}
]
},
userSegment: {}
},
segmentId: ''
}
],
viewId: ''
}
],
useResourceQuotas: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v4/reports:batchGet');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
reportRequests: [
{
cohortGroup: {
cohorts: [
{
dateRange: {
endDate: '',
startDate: ''
},
name: '',
type: ''
}
],
lifetimeValue: false
},
dateRanges: [
{}
],
dimensionFilterClauses: [
{
filters: [
{
caseSensitive: false,
dimensionName: '',
expressions: [],
not: false,
operator: ''
}
],
operator: ''
}
],
dimensions: [
{
histogramBuckets: [],
name: ''
}
],
filtersExpression: '',
hideTotals: false,
hideValueRanges: false,
includeEmptyRows: false,
metricFilterClauses: [
{
filters: [
{
comparisonValue: '',
metricName: '',
not: false,
operator: ''
}
],
operator: ''
}
],
metrics: [
{
alias: '',
expression: '',
formattingType: ''
}
],
orderBys: [
{
fieldName: '',
orderType: '',
sortOrder: ''
}
],
pageSize: 0,
pageToken: '',
pivots: [
{
dimensionFilterClauses: [
{}
],
dimensions: [
{}
],
maxGroupCount: 0,
metrics: [
{}
],
startGroup: 0
}
],
samplingLevel: '',
segments: [
{
dynamicSegment: {
name: '',
sessionSegment: {
segmentFilters: [
{
not: false,
sequenceSegment: {
firstStepShouldMatchFirstHit: false,
segmentSequenceSteps: [
{
matchType: '',
orFiltersForSegment: [
{
segmentFilterClauses: [
{
dimensionFilter: {
caseSensitive: false,
dimensionName: '',
expressions: [],
maxComparisonValue: '',
minComparisonValue: '',
operator: ''
},
metricFilter: {
comparisonValue: '',
maxComparisonValue: '',
metricName: '',
operator: '',
scope: ''
},
not: false
}
]
}
]
}
]
},
simpleSegment: {
orFiltersForSegment: [
{}
]
}
}
]
},
userSegment: {}
},
segmentId: ''
}
],
viewId: ''
}
],
useResourceQuotas: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/reports:batchGet',
headers: {'content-type': 'application/json'},
data: {
reportRequests: [
{
cohortGroup: {
cohorts: [{dateRange: {endDate: '', startDate: ''}, name: '', type: ''}],
lifetimeValue: false
},
dateRanges: [{}],
dimensionFilterClauses: [
{
filters: [
{
caseSensitive: false,
dimensionName: '',
expressions: [],
not: false,
operator: ''
}
],
operator: ''
}
],
dimensions: [{histogramBuckets: [], name: ''}],
filtersExpression: '',
hideTotals: false,
hideValueRanges: false,
includeEmptyRows: false,
metricFilterClauses: [
{
filters: [{comparisonValue: '', metricName: '', not: false, operator: ''}],
operator: ''
}
],
metrics: [{alias: '', expression: '', formattingType: ''}],
orderBys: [{fieldName: '', orderType: '', sortOrder: ''}],
pageSize: 0,
pageToken: '',
pivots: [
{
dimensionFilterClauses: [{}],
dimensions: [{}],
maxGroupCount: 0,
metrics: [{}],
startGroup: 0
}
],
samplingLevel: '',
segments: [
{
dynamicSegment: {
name: '',
sessionSegment: {
segmentFilters: [
{
not: false,
sequenceSegment: {
firstStepShouldMatchFirstHit: false,
segmentSequenceSteps: [
{
matchType: '',
orFiltersForSegment: [
{
segmentFilterClauses: [
{
dimensionFilter: {
caseSensitive: false,
dimensionName: '',
expressions: [],
maxComparisonValue: '',
minComparisonValue: '',
operator: ''
},
metricFilter: {
comparisonValue: '',
maxComparisonValue: '',
metricName: '',
operator: '',
scope: ''
},
not: false
}
]
}
]
}
]
},
simpleSegment: {orFiltersForSegment: [{}]}
}
]
},
userSegment: {}
},
segmentId: ''
}
],
viewId: ''
}
],
useResourceQuotas: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/reports:batchGet';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"reportRequests":[{"cohortGroup":{"cohorts":[{"dateRange":{"endDate":"","startDate":""},"name":"","type":""}],"lifetimeValue":false},"dateRanges":[{}],"dimensionFilterClauses":[{"filters":[{"caseSensitive":false,"dimensionName":"","expressions":[],"not":false,"operator":""}],"operator":""}],"dimensions":[{"histogramBuckets":[],"name":""}],"filtersExpression":"","hideTotals":false,"hideValueRanges":false,"includeEmptyRows":false,"metricFilterClauses":[{"filters":[{"comparisonValue":"","metricName":"","not":false,"operator":""}],"operator":""}],"metrics":[{"alias":"","expression":"","formattingType":""}],"orderBys":[{"fieldName":"","orderType":"","sortOrder":""}],"pageSize":0,"pageToken":"","pivots":[{"dimensionFilterClauses":[{}],"dimensions":[{}],"maxGroupCount":0,"metrics":[{}],"startGroup":0}],"samplingLevel":"","segments":[{"dynamicSegment":{"name":"","sessionSegment":{"segmentFilters":[{"not":false,"sequenceSegment":{"firstStepShouldMatchFirstHit":false,"segmentSequenceSteps":[{"matchType":"","orFiltersForSegment":[{"segmentFilterClauses":[{"dimensionFilter":{"caseSensitive":false,"dimensionName":"","expressions":[],"maxComparisonValue":"","minComparisonValue":"","operator":""},"metricFilter":{"comparisonValue":"","maxComparisonValue":"","metricName":"","operator":"","scope":""},"not":false}]}]}]},"simpleSegment":{"orFiltersForSegment":[{}]}}]},"userSegment":{}},"segmentId":""}],"viewId":""}],"useResourceQuotas":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"reportRequests": @[ @{ @"cohortGroup": @{ @"cohorts": @[ @{ @"dateRange": @{ @"endDate": @"", @"startDate": @"" }, @"name": @"", @"type": @"" } ], @"lifetimeValue": @NO }, @"dateRanges": @[ @{ } ], @"dimensionFilterClauses": @[ @{ @"filters": @[ @{ @"caseSensitive": @NO, @"dimensionName": @"", @"expressions": @[ ], @"not": @NO, @"operator": @"" } ], @"operator": @"" } ], @"dimensions": @[ @{ @"histogramBuckets": @[ ], @"name": @"" } ], @"filtersExpression": @"", @"hideTotals": @NO, @"hideValueRanges": @NO, @"includeEmptyRows": @NO, @"metricFilterClauses": @[ @{ @"filters": @[ @{ @"comparisonValue": @"", @"metricName": @"", @"not": @NO, @"operator": @"" } ], @"operator": @"" } ], @"metrics": @[ @{ @"alias": @"", @"expression": @"", @"formattingType": @"" } ], @"orderBys": @[ @{ @"fieldName": @"", @"orderType": @"", @"sortOrder": @"" } ], @"pageSize": @0, @"pageToken": @"", @"pivots": @[ @{ @"dimensionFilterClauses": @[ @{ } ], @"dimensions": @[ @{ } ], @"maxGroupCount": @0, @"metrics": @[ @{ } ], @"startGroup": @0 } ], @"samplingLevel": @"", @"segments": @[ @{ @"dynamicSegment": @{ @"name": @"", @"sessionSegment": @{ @"segmentFilters": @[ @{ @"not": @NO, @"sequenceSegment": @{ @"firstStepShouldMatchFirstHit": @NO, @"segmentSequenceSteps": @[ @{ @"matchType": @"", @"orFiltersForSegment": @[ @{ @"segmentFilterClauses": @[ @{ @"dimensionFilter": @{ @"caseSensitive": @NO, @"dimensionName": @"", @"expressions": @[ ], @"maxComparisonValue": @"", @"minComparisonValue": @"", @"operator": @"" }, @"metricFilter": @{ @"comparisonValue": @"", @"maxComparisonValue": @"", @"metricName": @"", @"operator": @"", @"scope": @"" }, @"not": @NO } ] } ] } ] }, @"simpleSegment": @{ @"orFiltersForSegment": @[ @{ } ] } } ] }, @"userSegment": @{ } }, @"segmentId": @"" } ], @"viewId": @"" } ],
@"useResourceQuotas": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/reports:batchGet"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/reports:batchGet" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/reports:batchGet",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reportRequests' => [
[
'cohortGroup' => [
'cohorts' => [
[
'dateRange' => [
'endDate' => '',
'startDate' => ''
],
'name' => '',
'type' => ''
]
],
'lifetimeValue' => null
],
'dateRanges' => [
[
]
],
'dimensionFilterClauses' => [
[
'filters' => [
[
'caseSensitive' => null,
'dimensionName' => '',
'expressions' => [
],
'not' => null,
'operator' => ''
]
],
'operator' => ''
]
],
'dimensions' => [
[
'histogramBuckets' => [
],
'name' => ''
]
],
'filtersExpression' => '',
'hideTotals' => null,
'hideValueRanges' => null,
'includeEmptyRows' => null,
'metricFilterClauses' => [
[
'filters' => [
[
'comparisonValue' => '',
'metricName' => '',
'not' => null,
'operator' => ''
]
],
'operator' => ''
]
],
'metrics' => [
[
'alias' => '',
'expression' => '',
'formattingType' => ''
]
],
'orderBys' => [
[
'fieldName' => '',
'orderType' => '',
'sortOrder' => ''
]
],
'pageSize' => 0,
'pageToken' => '',
'pivots' => [
[
'dimensionFilterClauses' => [
[
]
],
'dimensions' => [
[
]
],
'maxGroupCount' => 0,
'metrics' => [
[
]
],
'startGroup' => 0
]
],
'samplingLevel' => '',
'segments' => [
[
'dynamicSegment' => [
'name' => '',
'sessionSegment' => [
'segmentFilters' => [
[
'not' => null,
'sequenceSegment' => [
'firstStepShouldMatchFirstHit' => null,
'segmentSequenceSteps' => [
[
'matchType' => '',
'orFiltersForSegment' => [
[
'segmentFilterClauses' => [
[
'dimensionFilter' => [
'caseSensitive' => null,
'dimensionName' => '',
'expressions' => [
],
'maxComparisonValue' => '',
'minComparisonValue' => '',
'operator' => ''
],
'metricFilter' => [
'comparisonValue' => '',
'maxComparisonValue' => '',
'metricName' => '',
'operator' => '',
'scope' => ''
],
'not' => null
]
]
]
]
]
]
],
'simpleSegment' => [
'orFiltersForSegment' => [
[
]
]
]
]
]
],
'userSegment' => [
]
],
'segmentId' => ''
]
],
'viewId' => ''
]
],
'useResourceQuotas' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v4/reports:batchGet', [
'body' => '{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v4/reports:batchGet');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'reportRequests' => [
[
'cohortGroup' => [
'cohorts' => [
[
'dateRange' => [
'endDate' => '',
'startDate' => ''
],
'name' => '',
'type' => ''
]
],
'lifetimeValue' => null
],
'dateRanges' => [
[
]
],
'dimensionFilterClauses' => [
[
'filters' => [
[
'caseSensitive' => null,
'dimensionName' => '',
'expressions' => [
],
'not' => null,
'operator' => ''
]
],
'operator' => ''
]
],
'dimensions' => [
[
'histogramBuckets' => [
],
'name' => ''
]
],
'filtersExpression' => '',
'hideTotals' => null,
'hideValueRanges' => null,
'includeEmptyRows' => null,
'metricFilterClauses' => [
[
'filters' => [
[
'comparisonValue' => '',
'metricName' => '',
'not' => null,
'operator' => ''
]
],
'operator' => ''
]
],
'metrics' => [
[
'alias' => '',
'expression' => '',
'formattingType' => ''
]
],
'orderBys' => [
[
'fieldName' => '',
'orderType' => '',
'sortOrder' => ''
]
],
'pageSize' => 0,
'pageToken' => '',
'pivots' => [
[
'dimensionFilterClauses' => [
[
]
],
'dimensions' => [
[
]
],
'maxGroupCount' => 0,
'metrics' => [
[
]
],
'startGroup' => 0
]
],
'samplingLevel' => '',
'segments' => [
[
'dynamicSegment' => [
'name' => '',
'sessionSegment' => [
'segmentFilters' => [
[
'not' => null,
'sequenceSegment' => [
'firstStepShouldMatchFirstHit' => null,
'segmentSequenceSteps' => [
[
'matchType' => '',
'orFiltersForSegment' => [
[
'segmentFilterClauses' => [
[
'dimensionFilter' => [
'caseSensitive' => null,
'dimensionName' => '',
'expressions' => [
],
'maxComparisonValue' => '',
'minComparisonValue' => '',
'operator' => ''
],
'metricFilter' => [
'comparisonValue' => '',
'maxComparisonValue' => '',
'metricName' => '',
'operator' => '',
'scope' => ''
],
'not' => null
]
]
]
]
]
]
],
'simpleSegment' => [
'orFiltersForSegment' => [
[
]
]
]
]
]
],
'userSegment' => [
]
],
'segmentId' => ''
]
],
'viewId' => ''
]
],
'useResourceQuotas' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'reportRequests' => [
[
'cohortGroup' => [
'cohorts' => [
[
'dateRange' => [
'endDate' => '',
'startDate' => ''
],
'name' => '',
'type' => ''
]
],
'lifetimeValue' => null
],
'dateRanges' => [
[
]
],
'dimensionFilterClauses' => [
[
'filters' => [
[
'caseSensitive' => null,
'dimensionName' => '',
'expressions' => [
],
'not' => null,
'operator' => ''
]
],
'operator' => ''
]
],
'dimensions' => [
[
'histogramBuckets' => [
],
'name' => ''
]
],
'filtersExpression' => '',
'hideTotals' => null,
'hideValueRanges' => null,
'includeEmptyRows' => null,
'metricFilterClauses' => [
[
'filters' => [
[
'comparisonValue' => '',
'metricName' => '',
'not' => null,
'operator' => ''
]
],
'operator' => ''
]
],
'metrics' => [
[
'alias' => '',
'expression' => '',
'formattingType' => ''
]
],
'orderBys' => [
[
'fieldName' => '',
'orderType' => '',
'sortOrder' => ''
]
],
'pageSize' => 0,
'pageToken' => '',
'pivots' => [
[
'dimensionFilterClauses' => [
[
]
],
'dimensions' => [
[
]
],
'maxGroupCount' => 0,
'metrics' => [
[
]
],
'startGroup' => 0
]
],
'samplingLevel' => '',
'segments' => [
[
'dynamicSegment' => [
'name' => '',
'sessionSegment' => [
'segmentFilters' => [
[
'not' => null,
'sequenceSegment' => [
'firstStepShouldMatchFirstHit' => null,
'segmentSequenceSteps' => [
[
'matchType' => '',
'orFiltersForSegment' => [
[
'segmentFilterClauses' => [
[
'dimensionFilter' => [
'caseSensitive' => null,
'dimensionName' => '',
'expressions' => [
],
'maxComparisonValue' => '',
'minComparisonValue' => '',
'operator' => ''
],
'metricFilter' => [
'comparisonValue' => '',
'maxComparisonValue' => '',
'metricName' => '',
'operator' => '',
'scope' => ''
],
'not' => null
]
]
]
]
]
]
],
'simpleSegment' => [
'orFiltersForSegment' => [
[
]
]
]
]
]
],
'userSegment' => [
]
],
'segmentId' => ''
]
],
'viewId' => ''
]
],
'useResourceQuotas' => null
]));
$request->setRequestUrl('{{baseUrl}}/v4/reports:batchGet');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/reports:batchGet' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/reports:batchGet' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v4/reports:batchGet", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/reports:batchGet"
payload = {
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": False
},
"dateRanges": [{}],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": False,
"dimensionName": "",
"expressions": [],
"not": False,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": False,
"hideValueRanges": False,
"includeEmptyRows": False,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": False,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [{}],
"dimensions": [{}],
"maxGroupCount": 0,
"metrics": [{}],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": { "segmentFilters": [
{
"not": False,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": False,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [{ "segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": False,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": False
}
] }]
}
]
},
"simpleSegment": { "orFiltersForSegment": [{}] }
}
] },
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/reports:batchGet"
payload <- "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/reports:batchGet")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v4/reports:batchGet') do |req|
req.body = "{\n \"reportRequests\": [\n {\n \"cohortGroup\": {\n \"cohorts\": [\n {\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"lifetimeValue\": false\n },\n \"dateRanges\": [\n {}\n ],\n \"dimensionFilterClauses\": [\n {\n \"filters\": [\n {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"dimensions\": [\n {\n \"histogramBuckets\": [],\n \"name\": \"\"\n }\n ],\n \"filtersExpression\": \"\",\n \"hideTotals\": false,\n \"hideValueRanges\": false,\n \"includeEmptyRows\": false,\n \"metricFilterClauses\": [\n {\n \"filters\": [\n {\n \"comparisonValue\": \"\",\n \"metricName\": \"\",\n \"not\": false,\n \"operator\": \"\"\n }\n ],\n \"operator\": \"\"\n }\n ],\n \"metrics\": [\n {\n \"alias\": \"\",\n \"expression\": \"\",\n \"formattingType\": \"\"\n }\n ],\n \"orderBys\": [\n {\n \"fieldName\": \"\",\n \"orderType\": \"\",\n \"sortOrder\": \"\"\n }\n ],\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"pivots\": [\n {\n \"dimensionFilterClauses\": [\n {}\n ],\n \"dimensions\": [\n {}\n ],\n \"maxGroupCount\": 0,\n \"metrics\": [\n {}\n ],\n \"startGroup\": 0\n }\n ],\n \"samplingLevel\": \"\",\n \"segments\": [\n {\n \"dynamicSegment\": {\n \"name\": \"\",\n \"sessionSegment\": {\n \"segmentFilters\": [\n {\n \"not\": false,\n \"sequenceSegment\": {\n \"firstStepShouldMatchFirstHit\": false,\n \"segmentSequenceSteps\": [\n {\n \"matchType\": \"\",\n \"orFiltersForSegment\": [\n {\n \"segmentFilterClauses\": [\n {\n \"dimensionFilter\": {\n \"caseSensitive\": false,\n \"dimensionName\": \"\",\n \"expressions\": [],\n \"maxComparisonValue\": \"\",\n \"minComparisonValue\": \"\",\n \"operator\": \"\"\n },\n \"metricFilter\": {\n \"comparisonValue\": \"\",\n \"maxComparisonValue\": \"\",\n \"metricName\": \"\",\n \"operator\": \"\",\n \"scope\": \"\"\n },\n \"not\": false\n }\n ]\n }\n ]\n }\n ]\n },\n \"simpleSegment\": {\n \"orFiltersForSegment\": [\n {}\n ]\n }\n }\n ]\n },\n \"userSegment\": {}\n },\n \"segmentId\": \"\"\n }\n ],\n \"viewId\": \"\"\n }\n ],\n \"useResourceQuotas\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/reports:batchGet";
let payload = json!({
"reportRequests": (
json!({
"cohortGroup": json!({
"cohorts": (
json!({
"dateRange": json!({
"endDate": "",
"startDate": ""
}),
"name": "",
"type": ""
})
),
"lifetimeValue": false
}),
"dateRanges": (json!({})),
"dimensionFilterClauses": (
json!({
"filters": (
json!({
"caseSensitive": false,
"dimensionName": "",
"expressions": (),
"not": false,
"operator": ""
})
),
"operator": ""
})
),
"dimensions": (
json!({
"histogramBuckets": (),
"name": ""
})
),
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": (
json!({
"filters": (
json!({
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
})
),
"operator": ""
})
),
"metrics": (
json!({
"alias": "",
"expression": "",
"formattingType": ""
})
),
"orderBys": (
json!({
"fieldName": "",
"orderType": "",
"sortOrder": ""
})
),
"pageSize": 0,
"pageToken": "",
"pivots": (
json!({
"dimensionFilterClauses": (json!({})),
"dimensions": (json!({})),
"maxGroupCount": 0,
"metrics": (json!({})),
"startGroup": 0
})
),
"samplingLevel": "",
"segments": (
json!({
"dynamicSegment": json!({
"name": "",
"sessionSegment": json!({"segmentFilters": (
json!({
"not": false,
"sequenceSegment": json!({
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": (
json!({
"matchType": "",
"orFiltersForSegment": (json!({"segmentFilterClauses": (
json!({
"dimensionFilter": json!({
"caseSensitive": false,
"dimensionName": "",
"expressions": (),
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
}),
"metricFilter": json!({
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
}),
"not": false
})
)}))
})
)
}),
"simpleSegment": json!({"orFiltersForSegment": (json!({}))})
})
)}),
"userSegment": json!({})
}),
"segmentId": ""
})
),
"viewId": ""
})
),
"useResourceQuotas": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v4/reports:batchGet \
--header 'content-type: application/json' \
--data '{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}'
echo '{
"reportRequests": [
{
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"endDate": "",
"startDate": ""
},
"name": "",
"type": ""
}
],
"lifetimeValue": false
},
"dateRanges": [
{}
],
"dimensionFilterClauses": [
{
"filters": [
{
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"dimensions": [
{
"histogramBuckets": [],
"name": ""
}
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
{
"filters": [
{
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
}
],
"operator": ""
}
],
"metrics": [
{
"alias": "",
"expression": "",
"formattingType": ""
}
],
"orderBys": [
{
"fieldName": "",
"orderType": "",
"sortOrder": ""
}
],
"pageSize": 0,
"pageToken": "",
"pivots": [
{
"dimensionFilterClauses": [
{}
],
"dimensions": [
{}
],
"maxGroupCount": 0,
"metrics": [
{}
],
"startGroup": 0
}
],
"samplingLevel": "",
"segments": [
{
"dynamicSegment": {
"name": "",
"sessionSegment": {
"segmentFilters": [
{
"not": false,
"sequenceSegment": {
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
{
"matchType": "",
"orFiltersForSegment": [
{
"segmentFilterClauses": [
{
"dimensionFilter": {
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
},
"metricFilter": {
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
},
"not": false
}
]
}
]
}
]
},
"simpleSegment": {
"orFiltersForSegment": [
{}
]
}
}
]
},
"userSegment": {}
},
"segmentId": ""
}
],
"viewId": ""
}
],
"useResourceQuotas": false
}' | \
http POST {{baseUrl}}/v4/reports:batchGet \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "reportRequests": [\n {\n "cohortGroup": {\n "cohorts": [\n {\n "dateRange": {\n "endDate": "",\n "startDate": ""\n },\n "name": "",\n "type": ""\n }\n ],\n "lifetimeValue": false\n },\n "dateRanges": [\n {}\n ],\n "dimensionFilterClauses": [\n {\n "filters": [\n {\n "caseSensitive": false,\n "dimensionName": "",\n "expressions": [],\n "not": false,\n "operator": ""\n }\n ],\n "operator": ""\n }\n ],\n "dimensions": [\n {\n "histogramBuckets": [],\n "name": ""\n }\n ],\n "filtersExpression": "",\n "hideTotals": false,\n "hideValueRanges": false,\n "includeEmptyRows": false,\n "metricFilterClauses": [\n {\n "filters": [\n {\n "comparisonValue": "",\n "metricName": "",\n "not": false,\n "operator": ""\n }\n ],\n "operator": ""\n }\n ],\n "metrics": [\n {\n "alias": "",\n "expression": "",\n "formattingType": ""\n }\n ],\n "orderBys": [\n {\n "fieldName": "",\n "orderType": "",\n "sortOrder": ""\n }\n ],\n "pageSize": 0,\n "pageToken": "",\n "pivots": [\n {\n "dimensionFilterClauses": [\n {}\n ],\n "dimensions": [\n {}\n ],\n "maxGroupCount": 0,\n "metrics": [\n {}\n ],\n "startGroup": 0\n }\n ],\n "samplingLevel": "",\n "segments": [\n {\n "dynamicSegment": {\n "name": "",\n "sessionSegment": {\n "segmentFilters": [\n {\n "not": false,\n "sequenceSegment": {\n "firstStepShouldMatchFirstHit": false,\n "segmentSequenceSteps": [\n {\n "matchType": "",\n "orFiltersForSegment": [\n {\n "segmentFilterClauses": [\n {\n "dimensionFilter": {\n "caseSensitive": false,\n "dimensionName": "",\n "expressions": [],\n "maxComparisonValue": "",\n "minComparisonValue": "",\n "operator": ""\n },\n "metricFilter": {\n "comparisonValue": "",\n "maxComparisonValue": "",\n "metricName": "",\n "operator": "",\n "scope": ""\n },\n "not": false\n }\n ]\n }\n ]\n }\n ]\n },\n "simpleSegment": {\n "orFiltersForSegment": [\n {}\n ]\n }\n }\n ]\n },\n "userSegment": {}\n },\n "segmentId": ""\n }\n ],\n "viewId": ""\n }\n ],\n "useResourceQuotas": false\n}' \
--output-document \
- {{baseUrl}}/v4/reports:batchGet
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"reportRequests": [
[
"cohortGroup": [
"cohorts": [
[
"dateRange": [
"endDate": "",
"startDate": ""
],
"name": "",
"type": ""
]
],
"lifetimeValue": false
],
"dateRanges": [[]],
"dimensionFilterClauses": [
[
"filters": [
[
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"not": false,
"operator": ""
]
],
"operator": ""
]
],
"dimensions": [
[
"histogramBuckets": [],
"name": ""
]
],
"filtersExpression": "",
"hideTotals": false,
"hideValueRanges": false,
"includeEmptyRows": false,
"metricFilterClauses": [
[
"filters": [
[
"comparisonValue": "",
"metricName": "",
"not": false,
"operator": ""
]
],
"operator": ""
]
],
"metrics": [
[
"alias": "",
"expression": "",
"formattingType": ""
]
],
"orderBys": [
[
"fieldName": "",
"orderType": "",
"sortOrder": ""
]
],
"pageSize": 0,
"pageToken": "",
"pivots": [
[
"dimensionFilterClauses": [[]],
"dimensions": [[]],
"maxGroupCount": 0,
"metrics": [[]],
"startGroup": 0
]
],
"samplingLevel": "",
"segments": [
[
"dynamicSegment": [
"name": "",
"sessionSegment": ["segmentFilters": [
[
"not": false,
"sequenceSegment": [
"firstStepShouldMatchFirstHit": false,
"segmentSequenceSteps": [
[
"matchType": "",
"orFiltersForSegment": [["segmentFilterClauses": [
[
"dimensionFilter": [
"caseSensitive": false,
"dimensionName": "",
"expressions": [],
"maxComparisonValue": "",
"minComparisonValue": "",
"operator": ""
],
"metricFilter": [
"comparisonValue": "",
"maxComparisonValue": "",
"metricName": "",
"operator": "",
"scope": ""
],
"not": false
]
]]]
]
]
],
"simpleSegment": ["orFiltersForSegment": [[]]]
]
]],
"userSegment": []
],
"segmentId": ""
]
],
"viewId": ""
]
],
"useResourceQuotas": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/reports:batchGet")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
analyticsreporting.userActivity.search
{{baseUrl}}/v4/userActivity:search
BODY json
{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/userActivity:search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v4/userActivity:search" {:content-type :json
:form-params {:activityTypes []
:dateRange {:endDate ""
:startDate ""}
:pageSize 0
:pageToken ""
:user {:type ""
:userId ""}
:viewId ""}})
require "http/client"
url = "{{baseUrl}}/v4/userActivity:search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v4/userActivity:search"),
Content = new StringContent("{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/userActivity:search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/userActivity:search"
payload := strings.NewReader("{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v4/userActivity:search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v4/userActivity:search")
.setHeader("content-type", "application/json")
.setBody("{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/userActivity:search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/userActivity:search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v4/userActivity:search")
.header("content-type", "application/json")
.body("{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}")
.asString();
const data = JSON.stringify({
activityTypes: [],
dateRange: {
endDate: '',
startDate: ''
},
pageSize: 0,
pageToken: '',
user: {
type: '',
userId: ''
},
viewId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v4/userActivity:search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/userActivity:search',
headers: {'content-type': 'application/json'},
data: {
activityTypes: [],
dateRange: {endDate: '', startDate: ''},
pageSize: 0,
pageToken: '',
user: {type: '', userId: ''},
viewId: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/userActivity:search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"activityTypes":[],"dateRange":{"endDate":"","startDate":""},"pageSize":0,"pageToken":"","user":{"type":"","userId":""},"viewId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/userActivity:search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "activityTypes": [],\n "dateRange": {\n "endDate": "",\n "startDate": ""\n },\n "pageSize": 0,\n "pageToken": "",\n "user": {\n "type": "",\n "userId": ""\n },\n "viewId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v4/userActivity:search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/userActivity:search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
activityTypes: [],
dateRange: {endDate: '', startDate: ''},
pageSize: 0,
pageToken: '',
user: {type: '', userId: ''},
viewId: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/userActivity:search',
headers: {'content-type': 'application/json'},
body: {
activityTypes: [],
dateRange: {endDate: '', startDate: ''},
pageSize: 0,
pageToken: '',
user: {type: '', userId: ''},
viewId: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v4/userActivity:search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
activityTypes: [],
dateRange: {
endDate: '',
startDate: ''
},
pageSize: 0,
pageToken: '',
user: {
type: '',
userId: ''
},
viewId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/userActivity:search',
headers: {'content-type': 'application/json'},
data: {
activityTypes: [],
dateRange: {endDate: '', startDate: ''},
pageSize: 0,
pageToken: '',
user: {type: '', userId: ''},
viewId: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/userActivity:search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"activityTypes":[],"dateRange":{"endDate":"","startDate":""},"pageSize":0,"pageToken":"","user":{"type":"","userId":""},"viewId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"activityTypes": @[ ],
@"dateRange": @{ @"endDate": @"", @"startDate": @"" },
@"pageSize": @0,
@"pageToken": @"",
@"user": @{ @"type": @"", @"userId": @"" },
@"viewId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/userActivity:search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/userActivity:search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/userActivity:search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'activityTypes' => [
],
'dateRange' => [
'endDate' => '',
'startDate' => ''
],
'pageSize' => 0,
'pageToken' => '',
'user' => [
'type' => '',
'userId' => ''
],
'viewId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v4/userActivity:search', [
'body' => '{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v4/userActivity:search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'activityTypes' => [
],
'dateRange' => [
'endDate' => '',
'startDate' => ''
],
'pageSize' => 0,
'pageToken' => '',
'user' => [
'type' => '',
'userId' => ''
],
'viewId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'activityTypes' => [
],
'dateRange' => [
'endDate' => '',
'startDate' => ''
],
'pageSize' => 0,
'pageToken' => '',
'user' => [
'type' => '',
'userId' => ''
],
'viewId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v4/userActivity:search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/userActivity:search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/userActivity:search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v4/userActivity:search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/userActivity:search"
payload = {
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/userActivity:search"
payload <- "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/userActivity:search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v4/userActivity:search') do |req|
req.body = "{\n \"activityTypes\": [],\n \"dateRange\": {\n \"endDate\": \"\",\n \"startDate\": \"\"\n },\n \"pageSize\": 0,\n \"pageToken\": \"\",\n \"user\": {\n \"type\": \"\",\n \"userId\": \"\"\n },\n \"viewId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/userActivity:search";
let payload = json!({
"activityTypes": (),
"dateRange": json!({
"endDate": "",
"startDate": ""
}),
"pageSize": 0,
"pageToken": "",
"user": json!({
"type": "",
"userId": ""
}),
"viewId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v4/userActivity:search \
--header 'content-type: application/json' \
--data '{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}'
echo '{
"activityTypes": [],
"dateRange": {
"endDate": "",
"startDate": ""
},
"pageSize": 0,
"pageToken": "",
"user": {
"type": "",
"userId": ""
},
"viewId": ""
}' | \
http POST {{baseUrl}}/v4/userActivity:search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "activityTypes": [],\n "dateRange": {\n "endDate": "",\n "startDate": ""\n },\n "pageSize": 0,\n "pageToken": "",\n "user": {\n "type": "",\n "userId": ""\n },\n "viewId": ""\n}' \
--output-document \
- {{baseUrl}}/v4/userActivity:search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"activityTypes": [],
"dateRange": [
"endDate": "",
"startDate": ""
],
"pageSize": 0,
"pageToken": "",
"user": [
"type": "",
"userId": ""
],
"viewId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/userActivity:search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()