python-amazon-ad-api 2.3.0__py3-none-any.whl → 2.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ad_api/api/__init__.py +76 -0
- ad_api/api/campaign_diagnostics.py +1 -1
- ad_api/api/dsp_ad_group_and_campaign.py +139 -0
- ad_api/api/dsp_audience_create.py +53 -0
- ad_api/api/dsp_bid_adjustments.py +193 -0
- ad_api/api/dsp_campaign_flights.py +119 -0
- ad_api/api/dsp_campaign_insights.py +59 -0
- ad_api/api/dsp_combined_audiences.py +83 -0
- ad_api/api/dsp_conversion_tracking_products.py +92 -0
- ad_api/api/dsp_conversions.py +442 -0
- ad_api/api/dsp_creatives.py +114 -0
- ad_api/api/dsp_deal_permissions.py +170 -0
- ad_api/api/dsp_deal_proposals.py +440 -0
- ad_api/api/dsp_deals.py +204 -0
- ad_api/api/dsp_deals_management.py +66 -0
- ad_api/api/dsp_discovery_advertised_product_categories.py +35 -0
- ad_api/api/dsp_discovery_apps.py +36 -0
- ad_api/api/dsp_discovery_domain_lists.py +36 -0
- ad_api/api/dsp_discovery_geo_locations.py +42 -0
- ad_api/api/dsp_discovery_iab_content.py +37 -0
- ad_api/api/dsp_discovery_inventory_source_exchanges.py +36 -0
- ad_api/api/dsp_discovery_products.py +102 -0
- ad_api/api/dsp_discovery_third_party_target_segments.py +36 -0
- ad_api/api/dsp_frequency_associations.py +138 -0
- ad_api/api/dsp_frequency_groups.py +112 -0
- ad_api/api/dsp_frequency_insights.py +85 -0
- ad_api/api/dsp_guidance.py +111 -0
- ad_api/api/dsp_inherited_settings.py +133 -0
- ad_api/api/dsp_inventory_groups.py +209 -0
- ad_api/api/dsp_measurement.py +693 -0
- ad_api/api/dsp_seats.py +43 -0
- ad_api/api/dsp_target_kpi_recommendations.py +44 -0
- ad_api/api/dsp_targeting.py +98 -0
- ad_api/api/forecast.py +130 -0
- ad_api/api/hashed_records.py +39 -0
- ad_api/api/historic_reach.py +148 -0
- ad_api/api/locations.py +57 -0
- ad_api/api/plan_management.py +1268 -0
- ad_api/api/record_management.py +121 -0
- ad_api/api/targetable_entities.py +89 -0
- ad_api/version.py +1 -1
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/METADATA +1 -1
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/RECORD +46 -8
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/WHEEL +0 -0
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
"""Measurement (beta) /dsp/measurement and /measurement.
|
|
2
|
+
|
|
3
|
+
Contract: Measurement 3.0, the *Measurement beta* entry at the first level of
|
|
4
|
+
*Amazon DSP*. Twenty-eight operations over twenty-one paths: eligibility checks,
|
|
5
|
+
studies (audience research, brand lift, creative testing, omnichannel metrics),
|
|
6
|
+
their results, surveys, and the vendor products.
|
|
7
|
+
|
|
8
|
+
Two things are unusual here.
|
|
9
|
+
|
|
10
|
+
**The prefixes are not uniform.** The study routes hang from
|
|
11
|
+
``/dsp/measurement/studies``, but planning and surveys hang from
|
|
12
|
+
``/measurement`` alone. Copy the path from the contract; do not build it.
|
|
13
|
+
|
|
14
|
+
**The version is not a short number.** These media types carry ``1``, ``1.1``,
|
|
15
|
+
``1.2`` and ``1.3`` depending on the route, and several accept more than one.
|
|
16
|
+
``version`` goes in whole, so ``version=\"1.1\"`` gives
|
|
17
|
+
``application/vnd.studymanagement.v1.1+json``. The default is the newest the
|
|
18
|
+
route accepts.
|
|
19
|
+
|
|
20
|
+
Only ``Amazon-Advertising-API-ClientId`` is required as a header. ``Scope`` and
|
|
21
|
+
``Amazon-Ads-AccountId`` are optional. The three ``result`` routes under
|
|
22
|
+
``/dsp/`` also declare ``Accept`` as required, which is the media type already
|
|
23
|
+
sent; extra headers go through ``extra_headers=``.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DspMeasurement(Client):
|
|
30
|
+
r"""Measurement (beta) - /dsp/measurement and /measurement
|
|
31
|
+
|
|
32
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/measurement
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
@sp_endpoint('/dsp/measurement/eligibility/audienceResearch', method='POST',
|
|
36
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
37
|
+
def check_audience_research_eligibility(self, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
38
|
+
r"""
|
|
39
|
+
Checks whether an advertiser can run an audience research study.
|
|
40
|
+
Read only despite the POST: the query goes in the body.
|
|
41
|
+
|
|
42
|
+
Keyword Args
|
|
43
|
+
|
|
44
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
45
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
ApiResponse, ``200``, with the eligibility.
|
|
49
|
+
"""
|
|
50
|
+
media_type = 'application/vnd.measurementeligibility.v' + version + '+json'
|
|
51
|
+
headers = {'Accept': media_type}
|
|
52
|
+
headers['Content-Type'] = media_type
|
|
53
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
54
|
+
return self._request(kwargs.pop('path'),
|
|
55
|
+
data=body, params=kwargs, headers=headers)
|
|
56
|
+
|
|
57
|
+
@sp_endpoint('/dsp/measurement/eligibility/brandLift', method='POST',
|
|
58
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
59
|
+
def check_brand_lift_eligibility(self, version: str = "1.1", **kwargs) -> ApiResponse:
|
|
60
|
+
r"""
|
|
61
|
+
Checks whether an advertiser can run a brand lift study.
|
|
62
|
+
|
|
63
|
+
Keyword Args
|
|
64
|
+
|
|
65
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``. [optional]
|
|
66
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
67
|
+
|
|
68
|
+
Returns
|
|
69
|
+
ApiResponse, ``200``, with the eligibility.
|
|
70
|
+
"""
|
|
71
|
+
media_type = 'application/vnd.measurementeligibility.v' + version + '+json'
|
|
72
|
+
headers = {'Accept': media_type}
|
|
73
|
+
headers['Content-Type'] = media_type
|
|
74
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
75
|
+
return self._request(kwargs.pop('path'),
|
|
76
|
+
data=body, params=kwargs, headers=headers)
|
|
77
|
+
|
|
78
|
+
@sp_endpoint('/dsp/measurement/eligibility/creativeTesting', method='POST',
|
|
79
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
80
|
+
def check_creative_testing_eligibility(self, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
81
|
+
r"""
|
|
82
|
+
Checks whether an advertiser can run a creative testing study.
|
|
83
|
+
|
|
84
|
+
Keyword Args
|
|
85
|
+
|
|
86
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
87
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
ApiResponse, ``200``.
|
|
91
|
+
"""
|
|
92
|
+
media_type = 'application/vnd.measurementeligibility.v' + version + '+json'
|
|
93
|
+
headers = {'Accept': media_type}
|
|
94
|
+
headers['Content-Type'] = media_type
|
|
95
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
96
|
+
return self._request(kwargs.pop('path'),
|
|
97
|
+
data=body, params=kwargs, headers=headers)
|
|
98
|
+
|
|
99
|
+
@sp_endpoint('/dsp/measurement/eligibility/omnichannelMetrics', method='POST',
|
|
100
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
101
|
+
def check_omnichannel_metrics_eligibility(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
102
|
+
r"""
|
|
103
|
+
Checks whether an advertiser can use omnichannel metrics.
|
|
104
|
+
|
|
105
|
+
Keyword Args
|
|
106
|
+
|
|
107
|
+
- ``version`` (str): the version in the media type, ``1.2``, ``1.3``. [optional]
|
|
108
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
109
|
+
|
|
110
|
+
Returns
|
|
111
|
+
ApiResponse, ``200``.
|
|
112
|
+
"""
|
|
113
|
+
media_type = 'application/vnd.measurementeligibility.v' + version + '+json'
|
|
114
|
+
headers = {'Accept': media_type}
|
|
115
|
+
headers['Content-Type'] = media_type
|
|
116
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
117
|
+
return self._request(kwargs.pop('path'),
|
|
118
|
+
data=body, params=kwargs, headers=headers)
|
|
119
|
+
|
|
120
|
+
@sp_endpoint('/measurement/planning/eligibility', method='POST',
|
|
121
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
122
|
+
def check_planning_eligibility(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
123
|
+
r"""
|
|
124
|
+
Checks eligibility for measurement planning. Note the path: /measurement/planning,
|
|
125
|
+
not /dsp/measurement/planning like the rest.
|
|
126
|
+
|
|
127
|
+
Keyword Args
|
|
128
|
+
|
|
129
|
+
- ``version`` (str): the version in the media type, ``1.1``, ``1.3``. [optional]
|
|
130
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
131
|
+
|
|
132
|
+
Returns
|
|
133
|
+
ApiResponse, ``200``.
|
|
134
|
+
"""
|
|
135
|
+
media_type = 'application/vnd.measurementeligibility.v' + version + '+json'
|
|
136
|
+
headers = {'Accept': media_type}
|
|
137
|
+
headers['Content-Type'] = media_type
|
|
138
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
139
|
+
return self._request(kwargs.pop('path'),
|
|
140
|
+
data=body, params=kwargs, headers=headers)
|
|
141
|
+
|
|
142
|
+
@sp_endpoint('/dsp/measurement/studies/audienceResearch', method='GET',
|
|
143
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
144
|
+
def list_audience_research_studies(self, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
145
|
+
r"""
|
|
146
|
+
Lists audience research studies. Read only.
|
|
147
|
+
|
|
148
|
+
Query Params
|
|
149
|
+
|
|
150
|
+
- ``studyIds``, ``advertiserId``, ``maxResults``, ``nextToken``. [optional]
|
|
151
|
+
|
|
152
|
+
Keyword Args
|
|
153
|
+
|
|
154
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
155
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
156
|
+
|
|
157
|
+
Returns
|
|
158
|
+
ApiResponse, ``200``, with the studies.
|
|
159
|
+
"""
|
|
160
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
161
|
+
headers = {'Accept': media_type}
|
|
162
|
+
return self._request(kwargs.pop('path'),
|
|
163
|
+
params=kwargs, headers=headers)
|
|
164
|
+
|
|
165
|
+
@sp_endpoint('/dsp/measurement/studies/audienceResearch', method='POST',
|
|
166
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
167
|
+
def create_audience_research_study(self, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
168
|
+
r"""
|
|
169
|
+
Creates an audience research study.
|
|
170
|
+
|
|
171
|
+
Keyword Args
|
|
172
|
+
|
|
173
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
174
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
175
|
+
|
|
176
|
+
Returns
|
|
177
|
+
ApiResponse, ``200``, not 207: this one is singular.
|
|
178
|
+
"""
|
|
179
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
180
|
+
headers = {'Accept': media_type}
|
|
181
|
+
headers['Content-Type'] = media_type
|
|
182
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
183
|
+
return self._request(kwargs.pop('path'),
|
|
184
|
+
data=body, params=kwargs, headers=headers)
|
|
185
|
+
|
|
186
|
+
@sp_endpoint('/dsp/measurement/studies/audienceResearch/{}', method='PUT',
|
|
187
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
188
|
+
def update_audience_research_study(self, studyId, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
189
|
+
r"""
|
|
190
|
+
Updates an audience research study.
|
|
191
|
+
|
|
192
|
+
Keyword Args
|
|
193
|
+
|
|
194
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
195
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
196
|
+
|
|
197
|
+
Returns
|
|
198
|
+
ApiResponse, ``200``.
|
|
199
|
+
"""
|
|
200
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
201
|
+
headers = {'Accept': media_type}
|
|
202
|
+
headers['Content-Type'] = media_type
|
|
203
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
204
|
+
return self._request(fill_query_params(kwargs.pop('path'), studyId),
|
|
205
|
+
data=body, params=kwargs, headers=headers)
|
|
206
|
+
|
|
207
|
+
@sp_endpoint('/dsp/measurement/studies/audienceResearch/{}/result', method='GET',
|
|
208
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
209
|
+
def get_audience_research_result(self, studyId, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
210
|
+
r"""
|
|
211
|
+
Reads the result of an audience research study.
|
|
212
|
+
|
|
213
|
+
The contract declares ``Accept`` as a **required** header on this route, which is
|
|
214
|
+
the media type already sent. Pass more headers through ``extra_headers=``.
|
|
215
|
+
|
|
216
|
+
Keyword Args
|
|
217
|
+
|
|
218
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
219
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
220
|
+
|
|
221
|
+
Returns
|
|
222
|
+
ApiResponse, ``200``, with the result.
|
|
223
|
+
"""
|
|
224
|
+
media_type = 'application/vnd.measurementresult.v' + version + '+json'
|
|
225
|
+
headers = {'Accept': media_type}
|
|
226
|
+
headers.update(kwargs.pop('extra_headers', {}))
|
|
227
|
+
return self._request(fill_query_params(kwargs.pop('path'), studyId),
|
|
228
|
+
params=kwargs, headers=headers)
|
|
229
|
+
|
|
230
|
+
@sp_endpoint('/dsp/measurement/studies/brandLift', method='GET',
|
|
231
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
232
|
+
def list_brand_lift_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
233
|
+
r"""
|
|
234
|
+
Lists brand lift studies. Read only. This is the widest one: four versions.
|
|
235
|
+
|
|
236
|
+
Query Params
|
|
237
|
+
|
|
238
|
+
- ``studyIdFilters``, ``advertiserId``, ``maxResults``, ``nextToken``. [optional]
|
|
239
|
+
|
|
240
|
+
Keyword Args
|
|
241
|
+
|
|
242
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
243
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
244
|
+
|
|
245
|
+
Returns
|
|
246
|
+
ApiResponse, ``200``, with the studies.
|
|
247
|
+
"""
|
|
248
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
249
|
+
headers = {'Accept': media_type}
|
|
250
|
+
return self._request(kwargs.pop('path'),
|
|
251
|
+
params=kwargs, headers=headers)
|
|
252
|
+
|
|
253
|
+
@sp_endpoint('/dsp/measurement/studies/brandLift', method='POST',
|
|
254
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
255
|
+
def create_brand_lift_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
256
|
+
r"""
|
|
257
|
+
Creates brand lift studies. The body carries a list, hence the 207.
|
|
258
|
+
|
|
259
|
+
Keyword Args
|
|
260
|
+
|
|
261
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
262
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
263
|
+
|
|
264
|
+
Returns
|
|
265
|
+
ApiResponse, **207** multi-status, one per study.
|
|
266
|
+
"""
|
|
267
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
268
|
+
headers = {'Accept': media_type}
|
|
269
|
+
headers['Content-Type'] = media_type
|
|
270
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
271
|
+
return self._request(kwargs.pop('path'),
|
|
272
|
+
data=body, params=kwargs, headers=headers)
|
|
273
|
+
|
|
274
|
+
@sp_endpoint('/dsp/measurement/studies/brandLift', method='PUT',
|
|
275
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
276
|
+
def update_brand_lift_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
277
|
+
r"""
|
|
278
|
+
Updates brand lift studies in bulk. No path parameter: the ids go in the body.
|
|
279
|
+
|
|
280
|
+
Keyword Args
|
|
281
|
+
|
|
282
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
283
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
284
|
+
|
|
285
|
+
Returns
|
|
286
|
+
ApiResponse, **207** multi-status.
|
|
287
|
+
"""
|
|
288
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
289
|
+
headers = {'Accept': media_type}
|
|
290
|
+
headers['Content-Type'] = media_type
|
|
291
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
292
|
+
return self._request(kwargs.pop('path'),
|
|
293
|
+
data=body, params=kwargs, headers=headers)
|
|
294
|
+
|
|
295
|
+
@sp_endpoint('/dsp/measurement/studies/creativeTesting', method='GET',
|
|
296
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
297
|
+
def list_creative_testing_studies(self, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
298
|
+
r"""
|
|
299
|
+
Lists creative testing studies. Read only.
|
|
300
|
+
|
|
301
|
+
Query Params
|
|
302
|
+
|
|
303
|
+
- ``studyIds``, ``advertiserId``, ``maxResults``, ``nextToken``. [optional]
|
|
304
|
+
|
|
305
|
+
Keyword Args
|
|
306
|
+
|
|
307
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
308
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
309
|
+
|
|
310
|
+
Returns
|
|
311
|
+
ApiResponse, ``200``.
|
|
312
|
+
"""
|
|
313
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
314
|
+
headers = {'Accept': media_type}
|
|
315
|
+
return self._request(kwargs.pop('path'),
|
|
316
|
+
params=kwargs, headers=headers)
|
|
317
|
+
|
|
318
|
+
@sp_endpoint('/dsp/measurement/studies/creativeTesting', method='POST',
|
|
319
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
320
|
+
def create_creative_testing_study(self, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
321
|
+
r"""
|
|
322
|
+
Creates a creative testing study.
|
|
323
|
+
|
|
324
|
+
Keyword Args
|
|
325
|
+
|
|
326
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
327
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
328
|
+
|
|
329
|
+
Returns
|
|
330
|
+
ApiResponse, ``200``.
|
|
331
|
+
"""
|
|
332
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
333
|
+
headers = {'Accept': media_type}
|
|
334
|
+
headers['Content-Type'] = media_type
|
|
335
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
336
|
+
return self._request(kwargs.pop('path'),
|
|
337
|
+
data=body, params=kwargs, headers=headers)
|
|
338
|
+
|
|
339
|
+
@sp_endpoint('/dsp/measurement/studies/creativeTesting/{}', method='PUT',
|
|
340
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
341
|
+
def update_creative_testing_study(self, studyId, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
342
|
+
r"""
|
|
343
|
+
Updates a creative testing study.
|
|
344
|
+
|
|
345
|
+
Keyword Args
|
|
346
|
+
|
|
347
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
348
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
349
|
+
|
|
350
|
+
Returns
|
|
351
|
+
ApiResponse, ``200``.
|
|
352
|
+
"""
|
|
353
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
354
|
+
headers = {'Accept': media_type}
|
|
355
|
+
headers['Content-Type'] = media_type
|
|
356
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
357
|
+
return self._request(fill_query_params(kwargs.pop('path'), studyId),
|
|
358
|
+
data=body, params=kwargs, headers=headers)
|
|
359
|
+
|
|
360
|
+
@sp_endpoint('/dsp/measurement/studies/creativeTesting/{}/result', method='GET',
|
|
361
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
362
|
+
def get_creative_testing_result(self, studyId, version: str = "1.2", **kwargs) -> ApiResponse:
|
|
363
|
+
r"""
|
|
364
|
+
Reads the result of a creative testing study. ``Accept`` is a required header
|
|
365
|
+
in the contract; pass extras through ``extra_headers=``.
|
|
366
|
+
|
|
367
|
+
Keyword Args
|
|
368
|
+
|
|
369
|
+
- ``version`` (str): the version in the media type, ``1.2``. [optional]
|
|
370
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
371
|
+
|
|
372
|
+
Returns
|
|
373
|
+
ApiResponse, ``200``.
|
|
374
|
+
"""
|
|
375
|
+
media_type = 'application/vnd.measurementresult.v' + version + '+json'
|
|
376
|
+
headers = {'Accept': media_type}
|
|
377
|
+
headers.update(kwargs.pop('extra_headers', {}))
|
|
378
|
+
return self._request(fill_query_params(kwargs.pop('path'), studyId),
|
|
379
|
+
params=kwargs, headers=headers)
|
|
380
|
+
|
|
381
|
+
@sp_endpoint('/dsp/measurement/studies/omnichannelMetrics', method='GET',
|
|
382
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
383
|
+
def list_omnichannel_metrics_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
384
|
+
r"""
|
|
385
|
+
Lists omnichannel metrics studies. Read only.
|
|
386
|
+
|
|
387
|
+
Query Params
|
|
388
|
+
|
|
389
|
+
- ``studyIds``, ``advertiserId``, ``maxResults``, ``nextToken``. [optional]
|
|
390
|
+
|
|
391
|
+
Keyword Args
|
|
392
|
+
|
|
393
|
+
- ``version`` (str): the version in the media type, ``1.2``, ``1.3``. [optional]
|
|
394
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
395
|
+
|
|
396
|
+
Returns
|
|
397
|
+
ApiResponse, ``200``.
|
|
398
|
+
"""
|
|
399
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
400
|
+
headers = {'Accept': media_type}
|
|
401
|
+
return self._request(kwargs.pop('path'),
|
|
402
|
+
params=kwargs, headers=headers)
|
|
403
|
+
|
|
404
|
+
@sp_endpoint('/dsp/measurement/studies/omnichannelMetrics', method='POST',
|
|
405
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
406
|
+
def create_omnichannel_metrics_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
407
|
+
r"""
|
|
408
|
+
Creates omnichannel metrics studies.
|
|
409
|
+
|
|
410
|
+
Keyword Args
|
|
411
|
+
|
|
412
|
+
- ``version`` (str): the version in the media type, ``1.2``, ``1.3``. [optional]
|
|
413
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
414
|
+
|
|
415
|
+
Returns
|
|
416
|
+
ApiResponse, **207** multi-status.
|
|
417
|
+
"""
|
|
418
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
419
|
+
headers = {'Accept': media_type}
|
|
420
|
+
headers['Content-Type'] = media_type
|
|
421
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
422
|
+
return self._request(kwargs.pop('path'),
|
|
423
|
+
data=body, params=kwargs, headers=headers)
|
|
424
|
+
|
|
425
|
+
@sp_endpoint('/dsp/measurement/studies/omnichannelMetrics', method='PUT',
|
|
426
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
427
|
+
def update_omnichannel_metrics_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
428
|
+
r"""
|
|
429
|
+
Updates omnichannel metrics studies in bulk.
|
|
430
|
+
|
|
431
|
+
Keyword Args
|
|
432
|
+
|
|
433
|
+
- ``version`` (str): the version in the media type, ``1.2``, ``1.3``. [optional]
|
|
434
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
435
|
+
|
|
436
|
+
Returns
|
|
437
|
+
ApiResponse, **207** multi-status.
|
|
438
|
+
"""
|
|
439
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
440
|
+
headers = {'Accept': media_type}
|
|
441
|
+
headers['Content-Type'] = media_type
|
|
442
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
443
|
+
return self._request(kwargs.pop('path'),
|
|
444
|
+
data=body, params=kwargs, headers=headers)
|
|
445
|
+
|
|
446
|
+
@sp_endpoint('/dsp/measurement/studies/omnichannelMetrics/{}/result', method='GET',
|
|
447
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
448
|
+
def get_omnichannel_metrics_result(self, studyId, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
449
|
+
r"""
|
|
450
|
+
Reads the result of an omnichannel metrics study.
|
|
451
|
+
|
|
452
|
+
The contract declares **no success response** for this route: ``responses`` is empty.
|
|
453
|
+
Expect the documented 400/401/403/404, and treat any body as undocumented.
|
|
454
|
+
|
|
455
|
+
Keyword Args
|
|
456
|
+
|
|
457
|
+
- ``version`` (str): the version in the media type, ``1.2``, ``1.3``. [optional]
|
|
458
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
459
|
+
|
|
460
|
+
Returns
|
|
461
|
+
ApiResponse, success code **not declared** in the contract.
|
|
462
|
+
"""
|
|
463
|
+
media_type = 'application/vnd.measurementresult.v' + version + '+json'
|
|
464
|
+
headers = {'Accept': media_type}
|
|
465
|
+
headers.update(kwargs.pop('extra_headers', {}))
|
|
466
|
+
return self._request(fill_query_params(kwargs.pop('path'), studyId),
|
|
467
|
+
params=kwargs, headers=headers)
|
|
468
|
+
|
|
469
|
+
@sp_endpoint('/measurement/studies', method='GET',
|
|
470
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
471
|
+
def list_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
472
|
+
r"""
|
|
473
|
+
Lists studies across the measurement programme. Read only. No /dsp/ here.
|
|
474
|
+
|
|
475
|
+
Query Params
|
|
476
|
+
|
|
477
|
+
- ``studyIds``, ``advertiserId``, ``maxResults``, ``nextToken``. [optional]
|
|
478
|
+
|
|
479
|
+
Keyword Args
|
|
480
|
+
|
|
481
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
482
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
483
|
+
|
|
484
|
+
Returns
|
|
485
|
+
ApiResponse, ``200``.
|
|
486
|
+
"""
|
|
487
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
488
|
+
headers = {'Accept': media_type}
|
|
489
|
+
return self._request(kwargs.pop('path'),
|
|
490
|
+
params=kwargs, headers=headers)
|
|
491
|
+
|
|
492
|
+
@sp_endpoint('/measurement/studies', method='DELETE',
|
|
493
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
494
|
+
def delete_studies(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
495
|
+
r"""
|
|
496
|
+
Deletes studies. The ids go in the query, not in the path.
|
|
497
|
+
|
|
498
|
+
Query Params
|
|
499
|
+
|
|
500
|
+
- ``studyIds``. [optional]
|
|
501
|
+
|
|
502
|
+
Keyword Args
|
|
503
|
+
|
|
504
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
505
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
506
|
+
|
|
507
|
+
Returns
|
|
508
|
+
ApiResponse, **207** multi-status.
|
|
509
|
+
"""
|
|
510
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
511
|
+
headers = {'Accept': media_type}
|
|
512
|
+
return self._request(kwargs.pop('path'),
|
|
513
|
+
params=kwargs, headers=headers)
|
|
514
|
+
|
|
515
|
+
@sp_endpoint('/measurement/studies/brandLift/{}/result', method='GET',
|
|
516
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
517
|
+
def get_brand_lift_result(self, studyId, version: str = "1.1", **kwargs) -> ApiResponse:
|
|
518
|
+
r"""
|
|
519
|
+
Reads the result of a brand lift study. Note this one is on /measurement, not
|
|
520
|
+
/dsp/measurement, and only answers v1 and v1.1.
|
|
521
|
+
|
|
522
|
+
Keyword Args
|
|
523
|
+
|
|
524
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``. [optional]
|
|
525
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
526
|
+
|
|
527
|
+
Returns
|
|
528
|
+
ApiResponse, ``200``.
|
|
529
|
+
"""
|
|
530
|
+
media_type = 'application/vnd.measurementresult.v' + version + '+json'
|
|
531
|
+
headers = {'Accept': media_type}
|
|
532
|
+
headers.update(kwargs.pop('extra_headers', {}))
|
|
533
|
+
return self._request(fill_query_params(kwargs.pop('path'), studyId),
|
|
534
|
+
params=kwargs, headers=headers)
|
|
535
|
+
|
|
536
|
+
@sp_endpoint('/measurement/studies/surveys', method='GET',
|
|
537
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
538
|
+
def list_surveys(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
539
|
+
r"""
|
|
540
|
+
Lists surveys. Read only.
|
|
541
|
+
|
|
542
|
+
Query Params
|
|
543
|
+
|
|
544
|
+
- ``surveyIds``, ``studyId``, ``maxResults``, ``nextToken``. [optional]
|
|
545
|
+
|
|
546
|
+
Keyword Args
|
|
547
|
+
|
|
548
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
549
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
550
|
+
|
|
551
|
+
Returns
|
|
552
|
+
ApiResponse, ``200``.
|
|
553
|
+
"""
|
|
554
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
555
|
+
headers = {'Accept': media_type}
|
|
556
|
+
return self._request(kwargs.pop('path'),
|
|
557
|
+
params=kwargs, headers=headers)
|
|
558
|
+
|
|
559
|
+
@sp_endpoint('/measurement/studies/surveys', method='POST',
|
|
560
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
561
|
+
def create_surveys(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
562
|
+
r"""
|
|
563
|
+
Creates surveys in bulk.
|
|
564
|
+
|
|
565
|
+
Keyword Args
|
|
566
|
+
|
|
567
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
568
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
569
|
+
|
|
570
|
+
Returns
|
|
571
|
+
ApiResponse, **207** multi-status.
|
|
572
|
+
"""
|
|
573
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
574
|
+
headers = {'Accept': media_type}
|
|
575
|
+
headers['Content-Type'] = media_type
|
|
576
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
577
|
+
return self._request(kwargs.pop('path'),
|
|
578
|
+
data=body, params=kwargs, headers=headers)
|
|
579
|
+
|
|
580
|
+
@sp_endpoint('/measurement/studies/surveys', method='PUT',
|
|
581
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
582
|
+
def update_surveys(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
583
|
+
r"""
|
|
584
|
+
Updates surveys in bulk.
|
|
585
|
+
|
|
586
|
+
Keyword Args
|
|
587
|
+
|
|
588
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``, ``1.2``, ``1.3``. [optional]
|
|
589
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
590
|
+
|
|
591
|
+
Returns
|
|
592
|
+
ApiResponse, **207** multi-status.
|
|
593
|
+
"""
|
|
594
|
+
media_type = 'application/vnd.studymanagement.v' + version + '+json'
|
|
595
|
+
headers = {'Accept': media_type}
|
|
596
|
+
headers['Content-Type'] = media_type
|
|
597
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
598
|
+
return self._request(kwargs.pop('path'),
|
|
599
|
+
data=body, params=kwargs, headers=headers)
|
|
600
|
+
|
|
601
|
+
@sp_endpoint('/measurement/vendorProducts/list', method='POST',
|
|
602
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
603
|
+
def list_vendor_products(self, version: str = "1.1", **kwargs) -> ApiResponse:
|
|
604
|
+
r"""
|
|
605
|
+
Lists the vendor products of the account. Read only despite the POST.
|
|
606
|
+
|
|
607
|
+
Query Params
|
|
608
|
+
|
|
609
|
+
- ``maxResults``, ``nextToken``. [optional]
|
|
610
|
+
|
|
611
|
+
Keyword Args
|
|
612
|
+
|
|
613
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``. [optional]
|
|
614
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
615
|
+
|
|
616
|
+
Returns
|
|
617
|
+
ApiResponse, ``200``.
|
|
618
|
+
"""
|
|
619
|
+
media_type = 'application/vnd.measurementvendor.v' + version + '+json'
|
|
620
|
+
headers = {'Accept': media_type}
|
|
621
|
+
headers['Content-Type'] = media_type
|
|
622
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
623
|
+
return self._request(kwargs.pop('path'),
|
|
624
|
+
data=body, params=kwargs, headers=headers)
|
|
625
|
+
|
|
626
|
+
@sp_endpoint('/measurement/vendorProducts/omnichannelMetrics/brands/list', method='POST',
|
|
627
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
628
|
+
def list_omnichannel_metrics_brands(self, version: str = "1.3", **kwargs) -> ApiResponse:
|
|
629
|
+
r"""
|
|
630
|
+
Lists the brands available for omnichannel metrics. Its media type is
|
|
631
|
+
ocmbrands, not measurementvendor.
|
|
632
|
+
|
|
633
|
+
Keyword Args
|
|
634
|
+
|
|
635
|
+
- ``version`` (str): the version in the media type, ``1.2``, ``1.3``. [optional]
|
|
636
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
637
|
+
|
|
638
|
+
Returns
|
|
639
|
+
ApiResponse, ``200``.
|
|
640
|
+
"""
|
|
641
|
+
media_type = 'application/vnd.ocmbrands.v' + version + '+json'
|
|
642
|
+
headers = {'Accept': media_type}
|
|
643
|
+
headers['Content-Type'] = media_type
|
|
644
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
645
|
+
return self._request(kwargs.pop('path'),
|
|
646
|
+
data=body, params=kwargs, headers=headers)
|
|
647
|
+
|
|
648
|
+
@sp_endpoint('/measurement/vendorProducts/policies', method='GET',
|
|
649
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
650
|
+
def get_vendor_product_policies(self, version: str = "1.1", **kwargs) -> ApiResponse:
|
|
651
|
+
r"""
|
|
652
|
+
Reads the policies of the vendor products.
|
|
653
|
+
|
|
654
|
+
Query Params
|
|
655
|
+
|
|
656
|
+
- ``vendorProductIds``, ``maxResults``, ``nextToken``. [optional]
|
|
657
|
+
|
|
658
|
+
Keyword Args
|
|
659
|
+
|
|
660
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``. [optional]
|
|
661
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
662
|
+
|
|
663
|
+
Returns
|
|
664
|
+
ApiResponse, ``200``.
|
|
665
|
+
"""
|
|
666
|
+
media_type = 'application/vnd.measurementvendor.v' + version + '+json'
|
|
667
|
+
headers = {'Accept': media_type}
|
|
668
|
+
return self._request(kwargs.pop('path'),
|
|
669
|
+
params=kwargs, headers=headers)
|
|
670
|
+
|
|
671
|
+
@sp_endpoint('/measurement/vendorProducts/surveyQuestionTemplates', method='GET',
|
|
672
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
673
|
+
def list_survey_question_templates(self, version: str = "1.1", **kwargs) -> ApiResponse:
|
|
674
|
+
r"""
|
|
675
|
+
Lists the survey question templates.
|
|
676
|
+
|
|
677
|
+
Query Params
|
|
678
|
+
|
|
679
|
+
- ``vendorProductIds``, ``surveyQuestionTemplateIds``, ``maxResults``,
|
|
680
|
+
``nextToken``. [optional]
|
|
681
|
+
|
|
682
|
+
Keyword Args
|
|
683
|
+
|
|
684
|
+
- ``version`` (str): the version in the media type, ``1``, ``1.1``. [optional]
|
|
685
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
686
|
+
|
|
687
|
+
Returns
|
|
688
|
+
ApiResponse, ``200``.
|
|
689
|
+
"""
|
|
690
|
+
media_type = 'application/vnd.measurementvendor.v' + version + '+json'
|
|
691
|
+
headers = {'Accept': media_type}
|
|
692
|
+
return self._request(kwargs.pop('path'),
|
|
693
|
+
params=kwargs, headers=headers)
|