When I call the Ads API I get the following error message telling me that I’m calling a deprecated version of the Ads API:
"message": "(#2635) You are calling a deprecated version of the Ads
API. Please update to the latest version: v13.0."
Here’s the code that returns the error:
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.customaudience import CustomAudience
from facebook_business.api import FacebookAdsApi
access_token = '123456678910'
id = 'act_12345678910'
FacebookAdsApi.init(access_token=access_token)
fields = [
]
params = {
'name': 'My new Custom Audience',
'subtype': 'CUSTOM',
'description': 'People who purchased on my website',
'customer_file_source': 'USER_PROVIDED_ONLY',
}
AdAccount(id).create_custom_audience(
fields=fields,
params=params,
)
Is there a way to configure the SDK to use the latest version of the Ads API?
2
Answers
There is an API config file which you can update found in:
<VIRTUAL_ENV>/facebook_business/apiconfig.py
which contains:
You can pass api_version=’v13.0′ as an argument in FacebookAdsApi.init(access_token=access_token).
Eg – FacebookAdsApi.init(access_token=access_token, api_version=’v13.0′)