Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking prefix 'act_' for parent_id. #74

Closed
hans-t opened this issue Jul 10, 2015 · 2 comments
Closed

Checking prefix 'act_' for parent_id. #74

hans-t opened this issue Jul 10, 2015 · 2 comments

Comments

@hans-t
Copy link

hans-t commented Jul 10, 2015

from facebookads import FacebookAdsApi
from facebookads.objects import CustomAudience

my_app_id = <APP_ID>
my_app_secret = '<APP_SECRET>'
my_access_token = '<ACCESS_TOKEN>'
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)

AD_ACCOUNT_ID = 1431453467646932

audience = CustomAudience(parent_id='{}'.format(AD_ACCOUNT_ID))
audience.update({
    CustomAudience.Field.name: 'someName',
    CustomAudience.Field.subtype: CustomAudience.Subtype.custom,
})

audience.remote_create()

When I ran this code it throws an error. But when I change the value of parent_id to 'act_{}'.format(AD_ACCOUNT_ID)', the code ran without error. Is this by design or a bug?

I would suggest that there is a check for parent_id whether it has prefix 'act_' or not.

@ezegolub
Copy link

+1, i'm having the same issue.

@ebzlo
Copy link

ebzlo commented Jul 13, 2015

Hey @hanstzalora, this is intended as the root node for an account is act_[0-9]+

We unfortunately cannot do a trivial check as parent_id can sometimes be [0-9]+ (in the event of Business Manager, for example).

I will look into possibilities here as we do know which edges depend on an ad account root node.

@ebzlo ebzlo closed this as completed Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants