python-amazon-ad-api 2.3.1__py3-none-any.whl → 2.4.1__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 +68 -0
- ad_api/api/dsp_ad_creative_association.py +147 -0
- 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_quick_actions.py +177 -0
- ad_api/api/dsp_seats.py +43 -0
- ad_api/api/dsp_seats_management.py +84 -0
- ad_api/api/dsp_target_kpi_recommendations.py +44 -0
- ad_api/api/dsp_targeting.py +98 -0
- ad_api/version.py +1 -1
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/METADATA +1 -1
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/RECORD +41 -7
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/WHEEL +0 -0
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
"""Conversions /accounts/{accountId}/dsp.
|
|
2
|
+
|
|
3
|
+
Contract: Conversions API 3.0, the *Conversions* entry at the first level of
|
|
4
|
+
*Amazon DSP*. Everything lives under ``/accounts/{accountId}/dsp/``: ad tags,
|
|
5
|
+
conversion definitions, ad tag event associations, mobile measurement partner
|
|
6
|
+
registrations, and the conversion associations of orders.
|
|
7
|
+
|
|
8
|
+
Only ``Amazon-Advertising-API-ClientId`` is required here. ``Scope`` and
|
|
9
|
+
``Amazon-Ads-AccountId`` are optional, and the manager header appears on some
|
|
10
|
+
of the routes. The account id goes **in the path**, not in a header.
|
|
11
|
+
|
|
12
|
+
**207 is the common success code**, not 200: the bulk routes answer one result
|
|
13
|
+
per item, which is the whole point of ``MultiStatus``. A few routes still answer
|
|
14
|
+
200, and the delete of the mobile measurement partner registrations is one of
|
|
15
|
+
them.
|
|
16
|
+
|
|
17
|
+
Several bodies accept more than one version of the media type. ``version`` picks
|
|
18
|
+
it, and the answer follows the same one on the routes that echo the body.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class DspConversions(Client):
|
|
25
|
+
r"""Conversions - /accounts/{accountId}/dsp
|
|
26
|
+
|
|
27
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/conversions
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
@sp_endpoint('/accounts/{}/dsp/amazonAdTag', method='GET',
|
|
31
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
32
|
+
def get_amazon_ad_tag(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
33
|
+
r"""
|
|
34
|
+
Reads the Amazon ad tag of the account. Read only.
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
200, `vnd.dspamazonadtags`.
|
|
38
|
+
|
|
39
|
+
Keyword Args
|
|
40
|
+
|
|
41
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
42
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
43
|
+
|
|
44
|
+
Returns
|
|
45
|
+
ApiResponse, ``200``, with the ad tag.
|
|
46
|
+
"""
|
|
47
|
+
media_type = 'application/vnd.dspamazonadtags.v' + version + '+json'
|
|
48
|
+
headers = {'Accept': media_type}
|
|
49
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
50
|
+
params=kwargs, headers=headers)
|
|
51
|
+
|
|
52
|
+
@sp_endpoint('/accounts/{}/dsp/adTagEvents/{}/list', method='GET',
|
|
53
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
54
|
+
def list_ad_tag_events(self, accountId, adTagId, version: str = "1", **kwargs) -> ApiResponse:
|
|
55
|
+
r"""
|
|
56
|
+
Lists the events of an ad tag. Read only.
|
|
57
|
+
|
|
58
|
+
Query Params
|
|
59
|
+
|
|
60
|
+
- ``searchTerm``, ``startDateTime``, ``endDateTime``,
|
|
61
|
+
``maxResults``, ``nextToken``. [optional]
|
|
62
|
+
|
|
63
|
+
Returns
|
|
64
|
+
200, `vnd.dspamazonadtagevents`.
|
|
65
|
+
|
|
66
|
+
Keyword Args
|
|
67
|
+
|
|
68
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
69
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
70
|
+
|
|
71
|
+
Returns
|
|
72
|
+
ApiResponse, ``200``, with the events.
|
|
73
|
+
"""
|
|
74
|
+
media_type = 'application/vnd.dspamazonadtagevents.v' + version + '+json'
|
|
75
|
+
headers = {'Accept': media_type}
|
|
76
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId, adTagId),
|
|
77
|
+
params=kwargs, headers=headers)
|
|
78
|
+
|
|
79
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions', method='POST',
|
|
80
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
81
|
+
def create_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
82
|
+
r"""
|
|
83
|
+
Creates conversion definitions. There is no single-create route: the
|
|
84
|
+
body carries a list, which is why the answer is 207.
|
|
85
|
+
|
|
86
|
+
Returns
|
|
87
|
+
207, one answer per definition.
|
|
88
|
+
|
|
89
|
+
Keyword Args
|
|
90
|
+
|
|
91
|
+
- ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
|
|
92
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
ApiResponse, **207** multi-status, one per definition.
|
|
96
|
+
"""
|
|
97
|
+
media_type = 'application/vnd.dspconversiondefinition.v' + version + '+json'
|
|
98
|
+
headers = {'Accept': media_type}
|
|
99
|
+
headers['Content-Type'] = media_type
|
|
100
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
101
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
102
|
+
data=body, params=kwargs, headers=headers)
|
|
103
|
+
|
|
104
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions', method='PUT',
|
|
105
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
106
|
+
def update_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
107
|
+
r"""
|
|
108
|
+
Updates conversion definitions in bulk.
|
|
109
|
+
|
|
110
|
+
Returns
|
|
111
|
+
207, one answer per definition.
|
|
112
|
+
|
|
113
|
+
Keyword Args
|
|
114
|
+
|
|
115
|
+
- ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
|
|
116
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
117
|
+
|
|
118
|
+
Returns
|
|
119
|
+
ApiResponse, **207** multi-status.
|
|
120
|
+
"""
|
|
121
|
+
media_type = 'application/vnd.dspconversiondefinition.v' + version + '+json'
|
|
122
|
+
headers = {'Accept': media_type}
|
|
123
|
+
headers['Content-Type'] = media_type
|
|
124
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
125
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
126
|
+
data=body, params=kwargs, headers=headers)
|
|
127
|
+
|
|
128
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions/delete', method='POST',
|
|
129
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
130
|
+
def delete_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
131
|
+
r"""
|
|
132
|
+
Deletes conversion definitions in bulk.
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
207, one answer per definition.
|
|
136
|
+
|
|
137
|
+
Keyword Args
|
|
138
|
+
|
|
139
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
140
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
141
|
+
|
|
142
|
+
Returns
|
|
143
|
+
ApiResponse, **207** multi-status.
|
|
144
|
+
"""
|
|
145
|
+
media_type = 'application/vnd.dspuserdeletionrequest.v' + version + '+json'
|
|
146
|
+
headers = {'Accept': media_type}
|
|
147
|
+
headers['Content-Type'] = media_type
|
|
148
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
149
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
150
|
+
data=body, params=kwargs, headers=headers)
|
|
151
|
+
|
|
152
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions/eventData', method='POST',
|
|
153
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
154
|
+
def import_conversion_event_data(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
155
|
+
r"""
|
|
156
|
+
Imports conversion event data.
|
|
157
|
+
|
|
158
|
+
Returns
|
|
159
|
+
207, one answer per event.
|
|
160
|
+
|
|
161
|
+
Keyword Args
|
|
162
|
+
|
|
163
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
164
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
165
|
+
|
|
166
|
+
Returns
|
|
167
|
+
ApiResponse, **207** multi-status.
|
|
168
|
+
"""
|
|
169
|
+
media_type = 'application/vnd.dspconversioneventimport.v' + version + '+json'
|
|
170
|
+
headers = {'Accept': media_type}
|
|
171
|
+
headers['Content-Type'] = media_type
|
|
172
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
173
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
174
|
+
data=body, params=kwargs, headers=headers)
|
|
175
|
+
|
|
176
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions/list', method='POST',
|
|
177
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
178
|
+
def list_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
179
|
+
r"""
|
|
180
|
+
Lists conversion definitions. Read only, `POST` because the filter goes in
|
|
181
|
+
the body. The request body and the answer use the same type.
|
|
182
|
+
|
|
183
|
+
Returns
|
|
184
|
+
200, with the list.
|
|
185
|
+
|
|
186
|
+
Keyword Args
|
|
187
|
+
|
|
188
|
+
- ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
|
|
189
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
190
|
+
|
|
191
|
+
Returns
|
|
192
|
+
ApiResponse, ``200``, with the definitions.
|
|
193
|
+
"""
|
|
194
|
+
media_type = 'application/vnd.dspconversiondefinition.v' + version + '+json'
|
|
195
|
+
headers = {'Accept': media_type}
|
|
196
|
+
headers['Content-Type'] = media_type
|
|
197
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
198
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
199
|
+
data=body, params=kwargs, headers=headers)
|
|
200
|
+
|
|
201
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions/{}/adTagEventAssociations', method='GET',
|
|
202
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
203
|
+
def get_ad_tag_event_associations(self, accountId, conversionDefinitionId, version: str = "1", **kwargs) -> ApiResponse:
|
|
204
|
+
r"""
|
|
205
|
+
Reads the ad tag event associations of a conversion definition.
|
|
206
|
+
|
|
207
|
+
Returns
|
|
208
|
+
200.
|
|
209
|
+
|
|
210
|
+
Keyword Args
|
|
211
|
+
|
|
212
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
213
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
214
|
+
|
|
215
|
+
Returns
|
|
216
|
+
ApiResponse, ``200``, with the associations.
|
|
217
|
+
"""
|
|
218
|
+
media_type = 'application/vnd.dspconversionadtageventassociation.v' + version + '+json'
|
|
219
|
+
headers = {'Accept': media_type}
|
|
220
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId, conversionDefinitionId),
|
|
221
|
+
params=kwargs, headers=headers)
|
|
222
|
+
|
|
223
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions/{}/adTagEventAssociations', method='POST',
|
|
224
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
225
|
+
def create_ad_tag_event_associations(self, accountId, conversionDefinitionId, version: str = "1", **kwargs) -> ApiResponse:
|
|
226
|
+
r"""
|
|
227
|
+
Creates ad tag event associations for a conversion definition.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
200, not 207.
|
|
231
|
+
|
|
232
|
+
Keyword Args
|
|
233
|
+
|
|
234
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
235
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
236
|
+
|
|
237
|
+
Returns
|
|
238
|
+
ApiResponse, ``200``.
|
|
239
|
+
"""
|
|
240
|
+
media_type = 'application/vnd.dspconversionadtageventassociation.v' + version + '+json'
|
|
241
|
+
headers = {'Accept': media_type}
|
|
242
|
+
headers['Content-Type'] = media_type
|
|
243
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
244
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId, conversionDefinitionId),
|
|
245
|
+
data=body, params=kwargs, headers=headers)
|
|
246
|
+
|
|
247
|
+
@sp_endpoint('/accounts/{}/dsp/conversionDefinitions/{}/mobileMeasurementPartnerAppRegistration', method='GET',
|
|
248
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
249
|
+
def get_mmp_app_registration(self, accountId, conversionDefinitionId, version: str = "1", **kwargs) -> ApiResponse:
|
|
250
|
+
r"""
|
|
251
|
+
Reads the mobile measurement partner app registration of a conversion
|
|
252
|
+
definition.
|
|
253
|
+
|
|
254
|
+
Returns
|
|
255
|
+
200.
|
|
256
|
+
|
|
257
|
+
Keyword Args
|
|
258
|
+
|
|
259
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
260
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
261
|
+
|
|
262
|
+
Returns
|
|
263
|
+
ApiResponse, ``200``.
|
|
264
|
+
"""
|
|
265
|
+
media_type = 'application/vnd.dspassociatedmobilemeasurementpartnerappregistration.v' + version + '+json'
|
|
266
|
+
headers = {'Accept': media_type}
|
|
267
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId, conversionDefinitionId),
|
|
268
|
+
params=kwargs, headers=headers)
|
|
269
|
+
|
|
270
|
+
@sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners', method='POST',
|
|
271
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
272
|
+
def create_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
273
|
+
r"""
|
|
274
|
+
Registers mobile measurement partner apps.
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
207, one answer per registration.
|
|
278
|
+
|
|
279
|
+
Keyword Args
|
|
280
|
+
|
|
281
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
282
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
283
|
+
|
|
284
|
+
Returns
|
|
285
|
+
ApiResponse, **207** multi-status.
|
|
286
|
+
"""
|
|
287
|
+
media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
|
|
288
|
+
headers = {'Accept': media_type}
|
|
289
|
+
headers['Content-Type'] = media_type
|
|
290
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
291
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
292
|
+
data=body, params=kwargs, headers=headers)
|
|
293
|
+
|
|
294
|
+
@sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners', method='PUT',
|
|
295
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
296
|
+
def update_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
297
|
+
r"""
|
|
298
|
+
Updates mobile measurement partner app registrations.
|
|
299
|
+
|
|
300
|
+
Returns
|
|
301
|
+
207, one answer per registration.
|
|
302
|
+
|
|
303
|
+
Keyword Args
|
|
304
|
+
|
|
305
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
306
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
307
|
+
|
|
308
|
+
Returns
|
|
309
|
+
ApiResponse, **207** multi-status.
|
|
310
|
+
"""
|
|
311
|
+
media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
|
|
312
|
+
headers = {'Accept': media_type}
|
|
313
|
+
headers['Content-Type'] = media_type
|
|
314
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
315
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
316
|
+
data=body, params=kwargs, headers=headers)
|
|
317
|
+
|
|
318
|
+
@sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners/delete', method='POST',
|
|
319
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
320
|
+
def delete_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
321
|
+
r"""
|
|
322
|
+
Deletes mobile measurement partner app registrations.
|
|
323
|
+
|
|
324
|
+
Returns
|
|
325
|
+
200, not 207, unlike the create and the update.
|
|
326
|
+
|
|
327
|
+
Keyword Args
|
|
328
|
+
|
|
329
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
330
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
331
|
+
|
|
332
|
+
Returns
|
|
333
|
+
ApiResponse, ``200``.
|
|
334
|
+
"""
|
|
335
|
+
media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
|
|
336
|
+
headers = {'Accept': media_type}
|
|
337
|
+
headers['Content-Type'] = media_type
|
|
338
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
339
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
340
|
+
data=body, params=kwargs, headers=headers)
|
|
341
|
+
|
|
342
|
+
@sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners/list', method='POST',
|
|
343
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
344
|
+
def list_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
345
|
+
r"""
|
|
346
|
+
Lists mobile measurement partner app registrations. Read only.
|
|
347
|
+
|
|
348
|
+
Returns
|
|
349
|
+
200.
|
|
350
|
+
|
|
351
|
+
Keyword Args
|
|
352
|
+
|
|
353
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
354
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
355
|
+
|
|
356
|
+
Returns
|
|
357
|
+
ApiResponse, ``200``, with the registrations.
|
|
358
|
+
"""
|
|
359
|
+
media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
|
|
360
|
+
headers = {'Accept': media_type}
|
|
361
|
+
headers['Content-Type'] = media_type
|
|
362
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
363
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
364
|
+
data=body, params=kwargs, headers=headers)
|
|
365
|
+
|
|
366
|
+
@sp_endpoint('/accounts/{}/dsp/orders/{}/conversionDefinitionAssociations', method='GET',
|
|
367
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
368
|
+
def get_order_conversion_associations(self, accountId, orderId, version: str = "1", **kwargs) -> ApiResponse:
|
|
369
|
+
r"""
|
|
370
|
+
Reads the conversion definition associations of an order. Read only.
|
|
371
|
+
|
|
372
|
+
Query Params
|
|
373
|
+
|
|
374
|
+
- ``maxResults``, ``nextToken``. [optional]
|
|
375
|
+
|
|
376
|
+
Returns
|
|
377
|
+
200. Version 3 is the campaign shape, 1 and 2 the order shape.
|
|
378
|
+
|
|
379
|
+
Keyword Args
|
|
380
|
+
|
|
381
|
+
- ``version`` (str): the version in the media type, one of ``1``, ``2``, ``3``. [optional]
|
|
382
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
383
|
+
|
|
384
|
+
Returns
|
|
385
|
+
ApiResponse, ``200``, with the associations.
|
|
386
|
+
"""
|
|
387
|
+
media_type = ('application/vnd.dspcampaignconversionassociation.v' + version
|
|
388
|
+
if version >= '3'
|
|
389
|
+
else 'application/vnd.dsporderconversionassociation.v' + version)
|
|
390
|
+
media_type += '+json'
|
|
391
|
+
headers = {'Accept': media_type}
|
|
392
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId, orderId),
|
|
393
|
+
params=kwargs, headers=headers)
|
|
394
|
+
|
|
395
|
+
@sp_endpoint('/accounts/{}/dsp/orders/{}/conversionDefinitionAssociations', method='POST',
|
|
396
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
397
|
+
def create_order_conversion_associations(self, accountId, orderId, version: str = "1", **kwargs) -> ApiResponse:
|
|
398
|
+
r"""
|
|
399
|
+
Associates conversion definitions with an order.
|
|
400
|
+
|
|
401
|
+
Returns
|
|
402
|
+
207, one answer per association.
|
|
403
|
+
|
|
404
|
+
Keyword Args
|
|
405
|
+
|
|
406
|
+
- ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
|
|
407
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
408
|
+
|
|
409
|
+
Returns
|
|
410
|
+
ApiResponse, **207** multi-status.
|
|
411
|
+
"""
|
|
412
|
+
media_type = 'application/vnd.dsporderconversionassociation.v' + version + '+json'
|
|
413
|
+
headers = {'Accept': media_type}
|
|
414
|
+
headers['Content-Type'] = media_type
|
|
415
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
416
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId, orderId),
|
|
417
|
+
data=body, params=kwargs, headers=headers)
|
|
418
|
+
|
|
419
|
+
@sp_endpoint('/accounts/{}/dsp/batchOrders/conversionDefinitionAssociations', method='POST',
|
|
420
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
421
|
+
def batch_get_conversion_associations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
|
|
422
|
+
r"""
|
|
423
|
+
Reads the conversion definition associations of many orders at once. Read
|
|
424
|
+
only despite the POST: the order ids go in the body.
|
|
425
|
+
|
|
426
|
+
Returns
|
|
427
|
+
200.
|
|
428
|
+
|
|
429
|
+
Keyword Args
|
|
430
|
+
|
|
431
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
432
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
433
|
+
|
|
434
|
+
Returns
|
|
435
|
+
ApiResponse, ``200``.
|
|
436
|
+
"""
|
|
437
|
+
media_type = 'application/vnd.dspbatchgetconversiondefinitions.v' + version + '+json'
|
|
438
|
+
headers = {'Accept': media_type}
|
|
439
|
+
headers['Content-Type'] = media_type
|
|
440
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
441
|
+
return self._request(fill_query_params(kwargs.pop('path'), accountId),
|
|
442
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Creative management /sd/creatives.
|
|
2
|
+
|
|
3
|
+
Contract: Creative Management 3.0, the *Creative management* entry of Amazon DSP.
|
|
4
|
+
Five operations over five paths, all plain ``application/json``: no version.
|
|
5
|
+
|
|
6
|
+
**The paths are ``/sd/creatives``**, not ``/dsp/``: the contract reuses the
|
|
7
|
+
Sponsored Display resource, so a URL check here must look at the verb and the
|
|
8
|
+
path, not at the product name.
|
|
9
|
+
|
|
10
|
+
Only ``ClientId`` and ``Scope`` are declared. There is no account id header, and
|
|
11
|
+
``Scope`` is required.
|
|
12
|
+
|
|
13
|
+
207 on the create and the update; 200 on the two reads and the preview.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DspCreatives(Client):
|
|
20
|
+
r"""Creative management - /sd/creatives
|
|
21
|
+
|
|
22
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-ad-creative
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@sp_endpoint('/sd/creatives', method='GET',
|
|
26
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
27
|
+
def list_creatives(self, **kwargs) -> ApiResponse:
|
|
28
|
+
r"""
|
|
29
|
+
Lists the creatives of the account. Read only.
|
|
30
|
+
|
|
31
|
+
Query Params
|
|
32
|
+
|
|
33
|
+
- ``startIndex``, ``count``, ``adGroupIdFilter``, ``creativeIdFilter``,
|
|
34
|
+
``moderationStatusFilter``. [optional]
|
|
35
|
+
|
|
36
|
+
Keyword Args
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
ApiResponse, ``200``, with the creatives.
|
|
40
|
+
"""
|
|
41
|
+
headers = {'Accept': 'application/json'}
|
|
42
|
+
return self._request(kwargs.pop('path'),
|
|
43
|
+
params=kwargs, headers=headers)
|
|
44
|
+
|
|
45
|
+
@sp_endpoint('/sd/creatives', method='POST',
|
|
46
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
47
|
+
def create_creatives(self, **kwargs) -> ApiResponse:
|
|
48
|
+
r"""
|
|
49
|
+
Creates creatives.
|
|
50
|
+
|
|
51
|
+
Keyword Args
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
ApiResponse, **207** multi-status, one per creative.
|
|
55
|
+
"""
|
|
56
|
+
headers = {'Accept': 'application/json'}
|
|
57
|
+
headers['Content-Type'] = 'application/json'
|
|
58
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
59
|
+
return self._request(kwargs.pop('path'),
|
|
60
|
+
data=body, params=kwargs, headers=headers)
|
|
61
|
+
|
|
62
|
+
@sp_endpoint('/sd/creatives', method='PUT',
|
|
63
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
64
|
+
def update_creatives(self, **kwargs) -> ApiResponse:
|
|
65
|
+
r"""
|
|
66
|
+
Updates creatives in bulk.
|
|
67
|
+
|
|
68
|
+
Keyword Args
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
ApiResponse, **207** multi-status.
|
|
72
|
+
"""
|
|
73
|
+
headers = {'Accept': 'application/json'}
|
|
74
|
+
headers['Content-Type'] = 'application/json'
|
|
75
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
76
|
+
return self._request(kwargs.pop('path'),
|
|
77
|
+
data=body, params=kwargs, headers=headers)
|
|
78
|
+
|
|
79
|
+
@sp_endpoint('/sd/creatives/preview', method='POST',
|
|
80
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
81
|
+
def preview_creative(self, **kwargs) -> ApiResponse:
|
|
82
|
+
r"""
|
|
83
|
+
Renders a preview of a creative.
|
|
84
|
+
|
|
85
|
+
Keyword Args
|
|
86
|
+
|
|
87
|
+
Returns
|
|
88
|
+
ApiResponse, ``200``, with the preview.
|
|
89
|
+
"""
|
|
90
|
+
headers = {'Accept': 'application/json'}
|
|
91
|
+
headers['Content-Type'] = 'application/json'
|
|
92
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
93
|
+
return self._request(kwargs.pop('path'),
|
|
94
|
+
data=body, params=kwargs, headers=headers)
|
|
95
|
+
|
|
96
|
+
@sp_endpoint('/sd/moderation/creatives', method='GET',
|
|
97
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
98
|
+
def list_moderation_creatives(self, **kwargs) -> ApiResponse:
|
|
99
|
+
r"""
|
|
100
|
+
Lists the creatives with their moderation status. Read only.
|
|
101
|
+
|
|
102
|
+
Query Params
|
|
103
|
+
|
|
104
|
+
- ``language``: **required**. [required]
|
|
105
|
+
- ``startIndex``, ``count``, ``adGroupIdFilter``, ``creativeIdFilter``. [optional]
|
|
106
|
+
|
|
107
|
+
Keyword Args
|
|
108
|
+
|
|
109
|
+
Returns
|
|
110
|
+
ApiResponse, ``200``, with the moderation status.
|
|
111
|
+
"""
|
|
112
|
+
headers = {'Accept': 'application/json'}
|
|
113
|
+
return self._request(kwargs.pop('path'),
|
|
114
|
+
params=kwargs, headers=headers)
|