Use a query to answer several related queries

post/aggregations
Internal-Use Only

Returns information about the treatments. In anticipating queries like how many times a subject has been contacted in the last N time-units through X channels for different values of N, for multiple time units, for different channel values X, this endpoint allows the user to provide the parameters so that these queries can be answered at once by aggregating the results of multiple queries. This is done by combining different values of time, time unit, contact channel and response channel.

The aggregation period is divided into widening sub-periods. The unit of division, such as hour, is provided in the aggregation specification. The first sub-period covers the endTimeStamp back to the start of the closest unit. The second sub-period adds one unit to the length. The last element of the array covers the entire aggregation period.

If the excludeFromContactRule field of a contact record is true, the record is excluded from the aggregation.

Request Samples

1

Response Samples

1{
2 "subjectId": "string",
3 "subjectLevel": "string",
4 "beginTimeStamp": "2019-08-24T14:15:22Z",
5 "endTimeStamp": "2019-08-24T14:15:22Z",
6 "contactedTimeStampAggregation": [
7 {
8 "periodLength": "string",
9 "periodUnit": "hour",
10 "timeStampType": "contacted",
11 "beginTimeStamp": "2019-08-24T14:15:22Z",
12 "endTimeStamp": "2019-08-24T14:15:22Z",
13 "contactedTreatments": [
14 "string"
15 ],
16 "presentedTreatments": [
17 "string"
18 ],
19 "respondedTreatments": [
20 "string"
21 ],
22 "channels": [
23 {
24 "name": "string",
25 "channelType": "contact",
26 "contactedTreatments": [
27 "string"
28 ],
29 "presentedTreatments": [
30 "string"
31 ],
32 "respondedTreatments": [
33 "string"
34 ]
35 }
36 ]
37 }
38 ],
39 "respondedTimeStampAggregation": [
40 {
41 "periodLength": "string",
42 "periodUnit": "hour",
43 "timeStampType": "contacted",
44 "beginTimeStamp": "2019-08-24T14:15:22Z",
45 "endTimeStamp": "2019-08-24T14:15:22Z",
46 "contactedTreatments": [
47 "string"
48 ],
49 "presentedTreatments": [
50 "string"
51 ],
52 "respondedTreatments": [
53 "string"
54 ],
55 "channels": [
56 {
57 "name": "string",
58 "channelType": "contact",
59 "contactedTreatments": [
60 "string"
61 ],
62 "presentedTreatments": [
63 "string"
64 ],
65 "respondedTreatments": [
66 "string"
67 ]
68 }
69 ]
70 }
71 ],
72 "contactChannelAggregation": [
73 {
74 "name": "string",
75 "channelType": "contact",
76 "contactedTreatments": [
77 "string"
78 ],
79 "presentedTreatments": [
80 "string"
81 ],
82 "respondedTreatments": [
83 "string"
84 ],
85 "beginTimeStamp": "2019-08-24T14:15:22Z",
86 "endTimeStamp": "2019-08-24T14:15:22Z",
87 "periods": [
88 {
89 "periodLength": "string",
90 "periodUnit": "hour",
91 "timeStampType": "contacted",
92 "beginTimeStamp": "2019-08-24T14:15:22Z",
93 "endTimeStamp": "2019-08-24T14:15:22Z",
94 "contactedTreatments": [
95 "string"
96 ],
97 "presentedTreatments": [
98 "string"
99 ],
100 "respondedTreatments": [
101 "string"
102 ]
103 }
104 ]
105 }
106 ],
107 "responseChannelAggregation": [
108 {
109 "name": "string",
110 "channelType": "contact",
111 "contactedTreatments": [
112 "string"
113 ],
114 "presentedTreatments": [
115 "string"
116 ],
117 "respondedTreatments": [
118 "string"
119 ],
120 "beginTimeStamp": "2019-08-24T14:15:22Z",
121 "endTimeStamp": "2019-08-24T14:15:22Z",
122 "periods": [
123 {
124 "periodLength": "string",
125 "periodUnit": "hour",
126 "timeStampType": "contacted",
127 "beginTimeStamp": "2019-08-24T14:15:22Z",
128 "endTimeStamp": "2019-08-24T14:15:22Z",
129 "contactedTreatments": [
130 "string"
131 ],
132 "presentedTreatments": [
133 "string"
134 ],
135 "respondedTreatments": [
136 "string"
137 ]
138 }
139 ]
140 }
141 ]
142}

Request Body

The aggregation parameters.

Specify how the aggregation is done. Aggregation is done for a subject, for one or more channels and for a definite time period sub-divided into segments such as one day, two days, and so on.

NameTypeRequiredDescription
subjectId
string
true

ID of the subject for whom the aggregation is done.

subjectLevel
string
true

Indicates the type of subject ID.

beginAggregationTimeStamp
string<date-time>
false

Begin aggregation from this time. If omitted, the aggregation starts from seven days prior to the time at which the request is serviced.

endAggregationTimeStamp
string<date-time>
false

Stop aggregation before this time. If omitted, the aggregation stops right before the time at which the request is serviced.

timeAggregationUnits
array [string]
false

The units to use for time-based aggregation. If omitted, the time unit is day. The other acceptable time unit is hour. Aggregation can be done in both time units.

contactChannels
array [string]
false

The contact channels to aggregate. All channels found are used in secondary aggregation if this is omitted. Through a contact channel, a subject is contacted.

responseChannels
array [string]
false

The response channels to aggregate. All channels found are used in secondary aggregation if this is omitted. Through a response channel, the subject responds to a treatment.

Responses

StatusMeaningDescription
200OKThe request succeeded.Schema
400Bad RequestThe request was invalid.HeadersSchema
404Not FoundNo resource exists at the requested path.Schema