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

ad_account.adrules_library.first.evaluation_spec raises JSON::ParserError #177

Open
tdutreui-solocal opened this issue Jun 13, 2022 · 0 comments

Comments

@tdutreui-solocal
Copy link

tdutreui-solocal commented Jun 13, 2022

Which SDK version are you using?

facebookbusiness (0.13.0.0)

What's the issue?

After successfully creating an Adrule, you cannot fetch it's evaluation_spec :
ad_account.adrules_library.first.evaluation_spec raises JSON::ParserError :

...
I, [2022-06-13T12:55:35.905899 #133]  INFO -- response: {"id":"120330000147955510","name":"pause_rule","evaluation_spec":{"evaluation_type":"SCHEDULE","filters":[{"field":"impressions","value":"10","operator":"GREATER_THAN"},{"field":"entity_type","value":"ADSET","operator":"EQUAL"},{"field":"time_preset","value":"THIS_MONTH","operator":"EQUAL"}]},"execution_spec":{"execution_type":"PAUSE"},"schedule_spec":{"schedule_type":"SEMI_HOURLY"}}
/home/effilab/vendor/bundle/ruby/3.1.0/gems/json-2.6.2/lib/json/common.rb:216:in `parse': 859: unexpected token at 'ADSET' (JSON::ParserError)

Steps/Sample code to reproduce the issue

Create an adrule :

hash={
      "name": "unpause_rule",
      "status": "DISABLED",
      "evaluation_spec": {
        "evaluation_type": "SCHEDULE",
        "filters": [
          {
            "field": "impressions",
            "operator": "LESS_THAN",
            "value": 1
          },
          {
            "field": "entity_type",
            "value": "ADSET",
            "operator": "EQUAL"
          },
          {
            "field": "time_preset",
            "value": "THIS_MONTH",
            "operator": "EQUAL"
          }
        ]
      },
      "execution_spec": {
        "execution_type": "UNPAUSE"
      },
      "schedule_spec": {
        "schedule_type": "SEMI_HOURLY"
      }
    }
ad_account.adrules_library.create(hash)

And then get its evaluation_spec ad_account.adrules_library.first.evaluation_spec

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

1 participant