'Facebook graph api website custom audience rules not created giving error

I am trying to create website custom audience using Facebook graph API. I have used the same rules data provided in their documentation, the audience created but the rule are not display there on Facebook Ads Manager side. It is displaying following error while trying to edit the audience.

This rule was created through API or third-party applications. It contains syntax that we currently don't support in our interface.

Following is the rule parameter value

{
    "inclusions": {
    "operator": "or",
    "rules": [{
        "event_sources": [
           {
             "id": "<PIXEL_ID>",
             "type": "pixel"
           }
        ],
        "retention_seconds": 8400,
        "filter": {
            "operator": "and",
            "filters": [{
                "field": "url",
                "operator": "i_contains",
                "value": "shoes"
            }]
        }
    }]
  }
}

Following is the link of Facebook documentation

https://developers.facebook.com/docs/marketing-api/audiences/guides/website-custom-audiences#create-audiences

enter image description here



Solution 1:[1]

I got the solution for this. Sharing in case others are facing the same issue.

Syntax which I was using earlier.

{
"inclusions": {
"operator": "or",
"rules": [{
    "event_sources": [
       {
         "id": "<PIXEL_ID>",
         "type": "pixel"
       }
    ],
    "retention_seconds": 8400,
    "filter": {
        "operator": "and",
        "filters": [{
            "field": "url",
            "operator": "i_contains",
            "value": "shoes"
        }]
    }
}]

} }

Correct Syntax

{
    "inclusions": {
        "operator": "or",
        "rules": [
            {
                "event_sources": [
                    {
                        "type": "pixel",
                        "id": <PixelId>
                    }
                ],
                "retention_seconds": 15552000,
                "filter": {
                    "operator": "and",
                    "filters": [
                        {
                            "operator": "or",
                            "filters": [
                                {
                                    "field": "url",
                                    "operator": "i_contains",
                                    "value": "shoes"
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nikhil