You might want to make partial updates to your targeted publishers - without re-submitting the entire collection. The PATCH request addresses this need - it allows you apply partial updates without re-submitting the contents of the publisher_targeting field.
(For an overview of patching, see: Patching Collections.)
Flow
- Use the PATCH verb to submit a Publisher Targeting Patch Object to the 'campaigns' resource.
- In the
publishers
field, include only theaccount_id
s that you want to add or remove.
The
account_id
is an alphabetic string.
Patch Example 1 - REMOVE publisher from targeting:
{
"patch_operation": "REMOVE",
"publisher_targeting": {
"publishers": [
"demo-publisher-1"
]
}
}
{
"patch_operation": "REMOVE",
"publisher_targeting": {
"publishers": [
"demo-publisher-1"
]
},
"publisher_bid_modifier": null,
"publisher_bid_strategy_modifiers": null
}
The Campaign Object is updated accordingly:
{
// other Campaign fields...
"publisher_targeting": {
"type": "EXCLUDE",
"value": [
"demo-publisher-1",
"demo-publisher-2",
"demo-publisher-3"
],
"href": null
}
}
{
// other Campaign fields...
"publisher_targeting": {
"type": "EXCLUDE",
"value": [
"demo-publisher-2",
"demo-publisher-3"
],
"href": null
}
}
Patch Example 2 - ADD publisher to targeting:
{
"patch_operation": "ADD",
"publisher_targeting": {
"publishers": [
"demo-publisher-1"
]
}
}
{
"patch_operation": "ADD",
"publisher_targeting": {
"publishers": [
"demo-publisher-1"
],
"publisher_bid_modifier": null,
"publisher_bid_strategy_modifiers": null
}
The Campaign Object is updated accordingly:
{
// other Campaign fields...
"publisher_targeting": {
"type": "EXCLUDE",
"value": [
"demo-publisher-2",
"demo-publisher-3"
],
"href": null
}
}
{
// other Campaign fields...
"publisher_targeting": {
"type": "EXCLUDE",
"value": [
"demo-publisher-1",
"demo-publisher-2",
"demo-publisher-3"
],
"href": null
}
}
When patching the list of excluded publishers, you can ADD or REMOVE only. (REPLACE is not supported.)