My goal is to associate all running ad id's with the creation time of the underlying asset. I think that this is the only way I can do it:
- Request all ad_ids running in an account
- For each ad id, get the creative id
- For each creative_id, get the object_story_spec or effective_object_story_id (for ads which are made from an existing post) 4a. Video ads, use the AdVideo with the asset ID
video = AdVideo(api=api, fbid=asset_id)
video.api_get(
fields=['created_time', 'updated_time'],
batch=batch,
success=partial(callback, asset_id=asset_id)
)
4b. Image ads: use the image hash to get the AdImage
image = AdImage(api=api, fbid=asset_id)
image.api_get(
fields=['created_time', 'updated_time', 'id'],
batch=batch,
success=partial(callback, asset_id=asset_id)
)
4c. For existing posts, use the Post API and get a long lived token like described here:
Use the graph tool to generate an access token Generate a long lived user token ;client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-user-access-token} Generate a long lived page token /<PAGE_ID>?fields=access_token&access_token=<LONG_LIVED_USER_TOKEN> Use that long lived page token to connect to the api From there, we have the ad_id and the creation date of the underlying asset, all with batches. I'm sure I'm over-complicating things though!