-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
date_preset value error #12
Comments
Hi @alexjs-dev Glad this project can help out! Could you give me more information as to what is being passed in FIELDS? Also, just to be sure, in your actual code, are there backticks (`) around the URL? Thanks! |
Hi @fredericharnois , Thanks for your reply. // ad account ID // ad, adset, campaign, account // https://developers.facebook.com/docs/marketing-api/insights/parameters#fields // https://developers.facebook.com/docs/marketing-api/insights/parameters#param // user access token linked to a Facebook app // number of days from 1 to 90 // https://developers.facebook.com/docs/marketing-api/insights/parameters#param // DO NOT MODIFY ANYTHING BELOW // function requestFacebookReport() { // Builds the Facebook Ads Insights API URL const options = { // Fetches & parses the URL // Caches the report run ID if (cached != null) { Logger.log(cache.get('campaign-report-id')); |
I discovered the error, i place date_preset as a field. Thanks anyway. i will close the issue |
@Alex-git-code Can you please tell me what did you did exactly to make your code work? |
Hi @fredericharnois
Many thanks for the code, it will help me a lot.
I have an issue related with the value of date_preset parameter.
I see in the documentation the accepted values are:
today, yesterday, this_month, last_month, this_quarter, lifetime, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_week_sun_sat, last_quarter, last_year, this_week_mon_today, this_week_sun_today, this_year, but whatever value I use i get the following error:
Exception: Request failed for https://graph.facebook.com returned code 400. Truncated server response: {"error":{"message":"(#100) date_preset is not valid for fields param. please check https://developers.facebook.com/docs/marketing-api/referen... (use muteHttpExceptions option to examine full response). (line 50, file "Code")
My code is:
const TIME_RANGE = 'yesterday';
const facebookUrl =
https://graph.facebook.com/v6.0/act_${AD_ACCOUNT_ID}/insights?level=${LEVEL}&fields=${FIELDS}&date_preset=${TIME_RANGE}&access_token=${TOKEN}&time_increment=${TIME_INCREMENT}&limit=5000
;Can you help me with this issue?
Thanks a lot!
The text was updated successfully, but these errors were encountered: