daroczig / fbRads

Analyze and manage Facebook ads from R using this client library to access their Marketing APIs
GNU Affero General Public License v3.0
153 stars 57 forks source link

Fixin Param currency on field reachestimate: This param is not valid","type":"OAuthException","code":100,"fbtrace_id":"HkjupRK9F\/z"}} #103

Closed Cyranka closed 6 years ago

Cyranka commented 6 years ago

I have been trying to get reach estimates for different audiences, but every time I try using the basic function, I have been getting the following error:

ERROR [2018-08-09 14:04:35] URL: https://graph.facebook.com/v3.1/act_319640814/reachestimate ERROR [2018-08-09 14:04:35] Method: GET ERROR [2018-08-09 14:04:35] Params: List of 3 $ currency : chr "USD" $ targeting_spec: 'json' chr "{\"geo_locations\":{\"countries\":[\"US\"]},\"publisher_platforms\":[\"facebook\"],\"flexible_spec\":[{\"interests\":[]}]}" $ optimize_for : chr "NONE" ERROR [2018-08-09 14:04:35] Header: {"x-app-usage":["{\"call_count\":1,\"total_cputime\":0,\"total_time\":0}"],"Strict-Transport-Security":["max-age=15552000; preload"],"x-fb-trace-id":["HkjupRK9F/z"],"x-fb-rev":["4192376"],"Content-Type":["application/json; charset=UTF-8"],"facebook-api-version":["v3.1"],"Cache-Control":["no-store"],"Pragma":["no-cache"],"Access-Control-Allow-Origin":["*"],"Expires":["Sat, 01 Jan 2000 00:00:00 GMT"],"WWW-Authenticate":["OAuth \"Facebook Platform\" \"invalid_request\" \"(#100) Param currency on field reachestimate: This param is not valid\""],"X-FB-Debug":["QBCO4VxgCKUQ9Hyiyg0r0Po41cf0uGlh5BUoeBCNt1BX6vdyByLPeQaM31p5b1/rWOZZuPoRGXzjZg9KOeNcMg=="],"Date":["Thu, 09 Aug 2018 18:04:35 GMT"],"Connection":["keep-alive"],"Content-Length":["156"],"status":["400"],"statusMessage":["Bad Request"]} ERROR [2018-08-09 14:04:35] Body: {"error":{"message":"(#100) Param currency on field reachestimate: This param is not valid","type":"OAuthException","code":100,"fbtrace_id":"HkjupRK9F\/z"}} Error in fbadrequest(fbacc, path = paste0("act", fbacc$account_id, "/reachestimate"), : (#100) Param currency on field reachestimate: This param is not valid

And here is the standard code I have been trying to run:

fbad_reachestimate(targeting_spec = list( geo_locations = list(countries = 'US'), publisher_platforms = "facebook", flexible_spec = list( list(interests = data.frame( id = NULL, name = NULL )) ) ))$users

Any ideas on what might be the issue? I have just started a new app with a new token, so I am confused as to what might be causing this behavior.

daroczig commented 6 years ago

I'm not actively using this API endpoint and it seems 2 params were deprecated in the recent API versions. I've just pushed a fix, pls reinstall and try again.

Cyranka commented 6 years ago

Seems to be working now. Thank you very much. Awesome package.

loook commented 4 years ago

Hi @daroczig

I have the same issue. Calling the fbad_reachestimate() function I have the error:

Error in fbadrequest(fbacc, path = paste0("act", fbacc$account_id, "/reachestimate"), : (#100) Param currency on field reachestimate: This param is not valid

Could you advise how to deal with that?

Thank you in advance.

daroczig commented 4 years ago

It's difficult to tell without knowing what request you made (eg sharing your actual fbad_reachestimate call), but that reference to currency looks suspicious.

daroczig commented 4 years ago

Actually, after a second look, I think you are using a very outdated version of fbRads ... try updating to the most recent one: https://github.com/daroczig/fbRads#development-version

loook commented 4 years ago

Actually, after a second look, I think you are using a very outdated version of fbRads ... try updating to the most recent one: https://github.com/daroczig/fbRads#development-version

Thank you. It works. You are cool!