# Get ad rules

<mark style="color:blue;">`GET`</mark> `https://us-central1-appgregator.cloudfunctions.net/facebook/adrules/`

#### Query Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| name<mark style="color:red;">\*</mark>             | String | ft-4                  |
| connection\_name<mark style="color:red;">\*</mark> | String | fbads-01              |
| adaccount\_id<mark style="color:red;">\*</mark>    | String | act\_1514519918873559 |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| x-api-key<mark style="color:red;">\*</mark> | String | U2Fsd...    |

{% tabs %}
{% tab title="200: OK Success" %}

```shell
{
    "data": [
        {
            "id": "23852206730700549",
            "name": "turn-on-rule7",
            "status": "ENABLED",
            "account_id": "1514519918873559",
            "created_by": {
                "name": "Ronald Adriansyah",
                "id": "3305578009767732"
            },
            "created_time": "2022-09-26T16:13:30+0700",
            "evaluation_spec": {
                "evaluation_type": "SCHEDULE",
                "filters": [
                    {
                        "field": "lifetime_impressions",
                        "value": "8000",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "cost_per",
                        "value": "10",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "entity_type",
                        "value": "CAMPAIGN",
                        "operator": "EQUAL"
                    },
                    {
                        "field": "time_preset",
                        "value": "MAXIMUM",
                        "operator": "EQUAL"
                    }
                ]
            },
            "execution_spec": {
                "execution_type": "PAUSE",
                "execution_options": [
                    {
                        "field": "user_ids",
                        "value": [
                            "3305578009767732"
                        ],
                        "operator": "EQUAL"
                    }
                ]
            },
            "schedule_spec": {
                "schedule_type": "DAILY"
            },
            "updated_time": "2022-09-26T16:33:03+0700"
        },
        {
            "id": "23852206728240549",
            "name": "Rules-6",
            "status": "ENABLED",
            "account_id": "1514519918873559",
            "created_by": {
                "name": "Ronald Adriansyah",
                "id": "3305578009767732"
            },
            "created_time": "2022-09-26T16:13:09+0700",
            "evaluation_spec": {
                "evaluation_type": "SCHEDULE",
                "filters": [
                    {
                        "field": "lifetime_impressions",
                        "value": "8000",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "cost_per",
                        "value": "10",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "entity_type",
                        "value": "CAMPAIGN",
                        "operator": "EQUAL"
                    },
                    {
                        "field": "time_preset",
                        "value": "MAXIMUM",
                        "operator": "EQUAL"
                    }
                ]
            },
            "execution_spec": {
                "execution_type": "PAUSE",
                "execution_options": [
                    {
                        "field": "user_ids",
                        "value": [
                            "3305578009767732"
                        ],
                        "operator": "EQUAL"
                    }
                ]
            },
            "schedule_spec": {
                "schedule_type": "DAILY"
            },
            "updated_time": "2022-09-26T16:13:09+0700"
        },
        {
            "id": "23852206630940549",
            "name": "custom-turnon-rule-1",
            "status": "ENABLED",
            "account_id": "1514519918873559",
            "created_by": {
                "name": "Ronald Adriansyah",
                "id": "3305578009767732"
            },
            "created_time": "2022-09-26T16:07:58+0700",
            "evaluation_spec": {
                "evaluation_type": "SCHEDULE",
                "filters": [
                    {
                        "field": "spent",
                        "value": "10",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "entity_type",
                        "value": "CAMPAIGN",
                        "operator": "EQUAL"
                    },
                    {
                        "field": "time_preset",
                        "value": "MAXIMUM",
                        "operator": "EQUAL"
                    }
                ]
            },
            "execution_spec": {
                "execution_type": "UNPAUSE",
                "execution_options": [
                    {
                        "field": "user_ids",
                        "value": [
                            "3305578009767732"
                        ],
                        "operator": "EQUAL"
                    },
                    {
                        "field": "alert_preferences",
                        "value": {
                            "instant": {
                                "trigger": "CHANGE"
                            },
                            "summary": {
                                "trigger": "CHANGE"
                            }
                        },
                        "operator": "EQUAL"
                    }
                ]
            },
            "schedule_spec": {
                "schedule_type": "DAILY"
            },
            "updated_time": "2022-09-26T16:07:58+0700"
        },
        {
            "id": "23852204932980549",
            "name": "Rules-4",
            "status": "ENABLED",
            "account_id": "1514519918873559",
            "created_by": {
                "name": "Ronald Adriansyah",
                "id": "3305578009767732"
            },
            "created_time": "2022-09-26T13:27:42+0700",
            "evaluation_spec": {
                "evaluation_type": "SCHEDULE",
                "filters": [
                    {
                        "field": "lifetime_impressions",
                        "value": "8000",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "cost_per",
                        "value": "10",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "entity_type",
                        "value": "CAMPAIGN",
                        "operator": "EQUAL"
                    },
                    {
                        "field": "time_preset",
                        "value": "MAXIMUM",
                        "operator": "EQUAL"
                    }
                ]
            },
            "execution_spec": {
                "execution_type": "PAUSE",
                "execution_options": [
                    {
                        "field": "user_ids",
                        "value": [
                            "3305578009767732"
                        ],
                        "operator": "EQUAL"
                    }
                ]
            },
            "schedule_spec": {
                "schedule_type": "DAILY"
            },
            "updated_time": "2022-09-26T13:27:42+0700"
        },
        {
            "id": "23852203383610549",
            "name": "rule1",
            "status": "ENABLED",
            "account_id": "1514519918873559",
            "created_by": {
                "name": "Ronald Adriansyah",
                "id": "3305578009767732"
            },
            "created_time": "2022-09-26T09:16:25+0700",
            "evaluation_spec": {
                "evaluation_type": "SCHEDULE",
                "filters": [
                    {
                        "field": "lifetime_impressions",
                        "value": "8000",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "cost_per",
                        "value": "10",
                        "operator": "GREATER_THAN"
                    },
                    {
                        "field": "entity_type",
                        "value": "CAMPAIGN",
                        "operator": "EQUAL"
                    },
                    {
                        "field": "time_preset",
                        "value": "MAXIMUM",
                        "operator": "EQUAL"
                    }
                ]
            },
            "execution_spec": {
                "execution_type": "PAUSE",
                "execution_options": [
                    {
                        "field": "user_ids",
                        "value": [
                            "3305578009767732"
                        ],
                        "operator": "EQUAL"
                    },
                    {
                        "field": "alert_preferences",
                        "value": {
                            "instant": {
                                "trigger": "CHANGE"
                            },
                            "summary": {
                                "trigger": "CHANGE"
                            }
                        },
                        "operator": "EQUAL"
                    }
                ]
            },
            "schedule_spec": {
                "schedule_type": "SEMI_HOURLY"
            },
            "updated_time": "2022-09-26T09:16:25+0700"
        }
    ],
    "paging": {
        "cursors": {
            "before": "MjM4NTIyMDY3MzA3MDA1NDkZD",
            "after": "MjM4NTIyMDMzODM2MTA1NDkZD"
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```shell
curl --location --request GET 'https://us-central1-appgregator.cloudfunctions.net/facebook/adrules/?name=ft-4&connection_name=fbads-01&adaccount_id=act_1514519918873559' \
--header 'x-api-key: U2Fsd...'
```

{% endtab %}

{% tab title="NodeJs - Axios" %}

```javascript
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://us-central1-appgregator.cloudfunctions.net/facebook/adrules/?name=ft-4&connection_name=fbads-01&adaccount_id=act_1514519918873559',
  headers: { 
    'x-api-key': 'U2Fsd...'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="PHP - cURL" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/facebook/adrules/?name=ft-4&connection_name=fbads-01&adaccount_id=act_1514519918873559',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'x-api-key: U2Fsd...'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}
{% endtabs %}
