General Guidelines
- Apply country targeting (via the
 campaignsendpoint) for 1 country only.- Apply postal code targeting (via the
 targetingendpoint) for the targeted country.
Sample Flow 1 - Apply Postal Code Targeting
- Fetch a newly created campaign, using the campaigns resource. In the example below, the campaign has no country targeting or postal codes targeting (
type= ALL): 
GET /backstage/api/1.0/demo-advertiser/campaigns/1234{
   "id": "1234"
   // other Campaign fields...
   "country_targeting": {
      "type": "ALL",
      "value": [],
      "href": null
   },
   // other Campaign fields...
   "postal_code_targeting": {
      "type": "ALL",
      "value": null,
      "href": "https://backstage.taboola.com/backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code"
   }
}The endpoint stored by the
hrefproperty forpostal_code_targetingreturns an empty array (i.e. no targeting).
- Update the country targeting, using the campaigns resource. Notice that  the 
typeis now INCLUDE and thevalueproperty contains the targeted collection (US): 
POST /backstage/api/1.0/demo-advertiser/campaigns/1234{
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ]
   }
}{
   "id": "1234",
   // other Campaign fields...
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ],
      "href": null
   }
}
Thehrefproperty for country targeting is alwaysnull.
- Update postal code targeting, using the targeting resource (see previous topic):
 
POST /backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code{
    "type": "INCLUDE",
    "collection":[
            "10001",
            "10002",
            "10003 
    ]
}{
    "type": "INCLUDE",
    "collection":[
            "10001",
            "10002",
            "10003 
    ]
}
To fetch a list of supported postal codes for a given country, see: Get Postal Codes for a Country
- View the updated campaign object, using the campaigns resource. Notice that 
typeis for postal code targeting has changed to INCLUDE: 
GET /backstage/api/1.0/demo-advertiser/campaigns/1234{
   "id": "1234",
   // other Campaign fields...
   "country_targeting": {
      "type": "INCLUDE",
      "value" : ["US"],
      "href": null
   },
   // other Campaign fields...
   "postal_code_targeting": {
      "type": "INCLUDE",
      "value": null,
      "href": "https://backstage.taboola.com/backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code"
   }
}
Thevalueproperty for postal code targeting is alwaysnull.
- Invoke the endpoint reference stored in the 
hrefproperty ofpostal_code_targeting. The same Targeting Restrictions Object (from Step 3 above) is returned: 
GET https://backstage.taboola.com/backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code{
    "type": "INCLUDE",
    "collection":[
            "10001",
            "10002",
            "10003 
    ]
}Sample Flow 2 - Remove Postal Code Targeting
- Update postal code targeting, using the targeting resource (see previous topic). Set the 
typeto ALL, without passing a value forcollection(i.e.collection=null): 
POST /backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code{
    "type": "ALL",
    "collection": null
}{
    "collection": [],
    "type": "ALL"
}- View the updated campaign object, using the campaigns resource. Notice that 
typeis now ALL for postal code targeting: 
GET /backstage/api/1.0/demo-advertiser/campaigns/1234{
   "id": "1234",
   // other Campaign fields...
   "country_targeting": {
      "type": "INCLUDE",
      "value" : ["US"],
      "href": null
   },
   // other Campaign fields...
   "postal_code_targeting": {
      "type": "ALL",
      "value": null,
      "href": "https://backstage.taboola.com/backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code"
   }
}- Invoke the endpoint reference stored in the 
hrefproperty ofpostal_code_targeting. The same Target ALL response (from Step 2) is returned: 
GET https://backstage.taboola.com/backstage/api/1.0/demo-advertiser/campaigns/1234/targeting/postal_code{
    "collection": [],
    "type": "ALL"
}