Change History open beta
https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/Eligibility_prod_3p.json
Provides information about changes made to campaigns, adgroups, ads, etc
- class ad_api.api.History(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, proxies=None, verify=True, timeout=None, debug=False, access_token=None)
- get_history(body: dict, str, file) ApiResponse
Returns history of changes for provided event sources that match the filters and time ranges specified. Only events that belong to the authenticated Advertiser can be queried. All times will be in UTC Epoch format. This API accepts identifiers in either the alphamumeric format (default), or the numeric format. If numeric IDs are supplied, then numeric IDs will be returned otherwise, alphanumeric IDs are returned.
body: | REQUIRED {‘description’: ‘A HistoryQuery}’
from_date | int | Max 90 days of history.to_date | int |event_types | HistoryEventTypenext_token | str | token from previous response to get next set of data. | [optional]page_offset | int | Mutually exclusive with 'nextToken'. Max results with pageOffset is 10000. Use nextToken instead for more results. | [optional]count | int | Requested number of results. Default 100. Minimum 50. Maximum 200. | [optional]sort | HistorySortParameterany string name | bool, date, datetime, dict, float, int, list, str, none_type | any string name can be used but the value must be the correct type | [optional]
### Example python
import logging from ad_api.api import History from ad_api.base import AdvertisingApiException def get_history(data: (str, dict)): try: result = History(debug=True).get_history( body=json.dumps(data) ) payload = result.payload events = payload.get("events") for event in events: logging.info(event) except AdvertisingApiException as error: logging.info(error) if __name__ == '__main__': # fromDate cannot be more than 90 days ago from_date = datetime(2022, 2, 1, 0, 0, 0).strftime('%s%f')[:-3] to_date = datetime.now().strftime('%s%f')[:-3] request = \ { "fromDate": int(from_date), "toDate": int(to_date), "eventTypes": { "CAMPAIGN": { "filters": [ "BUDGET_AMOUNT", "STATUS" ], "eventTypeIds": [ "45662011530311" ] } } } get_history(request)
### Example query.json
Download
json
the file to use:{ "fromDate": 1626739199000, "toDate": 1632095999000, "pageOffset": 10, "count": 60, "sort": { "key": "DATE", "direction": "DESC" }, "eventTypes": { "CAMPAIGN": { "filters": [ "BUDGET_AMOUNT" ], "eventTypeIds": [ "137359064782313" ] } } }