from facebook_business.api import FacebookAdsApi from facebook_business.api import FacebookRequest access_token = '' app_secret = ' ' app_id = ' ' FacebookAdsApi.init(access_token=access_token, app_secret=app_secret, app_id=app_id) request = FacebookRequest( node_id='act_ ', method='GET', ) response = request.execute() print(response)
from facebook_business.adobjects.adcreative import AdCreative from facebook_business.adobjects.adcreativeobjectstoryspec import AdCreativeObjectStorySpec from facebook_business.adobjects.adcreativelinkdata import AdCreativeLinkData from facebook_business.adobjects.adcreativeasset import AdCreativeAsset from facebook_business.adobjects.adaccount import AdAccount from facebook_business.api import FacebookAdsApi from facebook_business.api import FacebookRequest access_token = 'In this example, we are using several classes from the `facebook_business.adobjects` module to create an ad creative. We are passing in the access token, app secret, and app id to initialize the `FacebookAdsApi`. Then, we are creating an `AdAccount` object with the ad account id. Next, we are creating an `AdCreativeAsset` object with the image url, and an `AdCreativeLinkData` object with the image hash and link url. We then create an `AdCreativeObjectStorySpec` object with the link data and finally an `AdCreative` object with the object story spec. Finally, we execute the remote_create() method to create the ad creative and print out the response.' app_secret = ' ' app_id = ' ' FacebookAdsApi.init(access_token=access_token, app_secret=app_secret, app_id=app_id) account = AdAccount(' ') image = AdCreativeAsset(image_url=' ') link_data = AdCreativeLinkData(image_hash=image.get_hash(), link=' ') object_story_spec = AdCreativeObjectStorySpec(link_data=link_data) creative = AdCreative(parent_id=account.get_id_assured(), object_story_spec=object_story_spec) response = creative.remote_create() print(response)