API ReferenceAnnouncementsCommunity Discussion
API ReferenceCommunity DiscussionAnnouncementsSubscribeLog In
API Reference

Examples

Example Notes

  • account_id = "demo-advertiser" and campaign_id = "1234"
  • Examples are successive (later examples presume values from earlier examples).

Apply country targeting

POST /backstage/api/1.0/demo-advertiser/campaigns/1234/
{
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ]
   }
}
{
   "id": "1234",
   //...
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ],
      "href": null
   }
   //...
}

Apply region targeting (for the targeted country)

In this example, region targeting is submitted via the region_country_targeting field. Note that the submitted values reflect in both the region_country_targeting and sub_country_targeting fields.

POST /backstage/api/1.0/demo-advertiser/campaigns/1234/
{
   "region_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "AZ",
         "CA",
         "DE"
      ]
   }
}
{
   "id": "1234",
   //...
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ],
      "href": null
   },
   "sub_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "AZ",
         "CA",
         "DE"
      ]
   },
   //...
   "region_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "AZ",
         "CA",
         "DE"
      ]
   }
   //...
}

📘

In the above example, country targeting was applied first, and then region targeting. Country and region targeting can also be submitted together, in the same request.

Remove some regions

  • In this example, region targeting is submitted via the sub_country_targeting field.
  • Note that the submitted values reflect in both the sub_country_targeting and region_country_targeting fields.
POST /backstage/api/1.0/demo-advertiser/campaigns/1234/
{
   "sub_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "AZ"
      ]
   }
}
{
   "id": "1234",
   //...
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ],
      "href": null
   },
   "sub_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "AZ"
      ]
   },
   //...
   "region_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "AZ"
      ]
   }
   //...
}

📘

Patch operations are not supported. To update the collection, submit a new collection and overwrite the old one.

Apply DMA targeting (US only)

  • In this example, DMA targeting is submitted via the dma_country_targeting field.
  • Note that the submitted values reflect in both the dma_country_targeting and sub_country_targeting fields.
  • Because DMA Targeting was updated, existing values for region targeting are cleared (type = "ALL").
POST /backstage/api/1.0/demo-advertiser/campaigns/1234/
{
   "dma_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "583",
         "800",
         "716"
      ]
   }
}
{
   "id": "1234",
   //...
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "US"
      ],
      "href": null
   },
   "sub_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "583",
         "800",
         "716"
      ]
   }, 
   "dma_country_targeting": {
      "type": "INCLUDE",
      "value": [
         "583",
         "800",
         "716"
      ]
   },
   "region_country_targeting": {
      "type": "ALL",
      "value": []
   }     
   //...
}

📘

You can apply region or DMA targeting - but not both.

Update country targeting

  • Any change to the country targeting will clear region and DMA targeting.
POST /backstage/api/1.0/demo-advertiser/campaigns/1234/
{
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "CA"
      ]
   }
}
{
   "id": "1234",
   //...
   "country_targeting": {
      "type": "INCLUDE",
      "value": [
         "CA"
      ],
      "href": null
   },
   "sub_country_targeting": {
      "type": "ALL",
      "value": []
   }, 
   "dma_country_targeting": {
      "type": "ALL",
      "value": []
   },
   "region_country_targeting": {
      "type": "ALL",
      "value": []
   }     
   //...
}