Closed amzar96 closed 1 year ago
Hi amzar96,
This repository contains all the method to create, update & request objects in the api ( AD_ACCOUNTS, PAGES, IG_USERS, VIDEOS etc ... ).
For example, if you are trying to know if a page has_transitioned_to_new_page_experience
, you can request this information with the graph request below.
ex : {PAGE_ID}?fields=id,name,has_transitioned_to_new_page_experience
Regards
Understand it is achievable using graph request. But from facebook_business.adobjects.page import Page
let's say I am using this method, how to get fields=id,name,has_transitioned_to_new_page_experience
these?
The snippet below should do the job for you 👍
You can check in the examples directory for more use cases : https://github.com/facebook/facebook-python-business-sdk/tree/main/examples
from facebook_business.adobjects.page import Page
from facebook_business.api import FacebookAdsApi
access_token = '<ACCESS_TOKEN>'
id = '<PAGE_ID>'
FacebookAdsApi.init(access_token=access_token)
fields = [
'id',
'name',
'has_transitioned_to_new_page_experience'
]
print(Page(id).api_get(fields=fields))
Got it, thanks @Just1B . Just know that it doesn't support date range.
Thanks
Depends on the type of data your are requesting, if you want to get page insights it does.
from facebook_business.adobjects.page import Page
from facebook_business.api import FacebookAdsApi
access_token = '<ACCESS_TOKEN>'
id = '<PAGE_ID>'
FacebookAdsApi.init(access_token=access_token)
fields = [ ... ]
params = {
'date_preset' = '<YOUR_PRESET>
}
print(Page(id).get_insights(fields=fields, params=params))
Facebook Python Business SDK Issue
I am coming from here. However, I'm not sure whether this repo is cover the new Page or not?