Update extensions (step 4)
curl --request PATCH \
--url http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"extensions": {
"sitelinks": [
{
"link_text": "<string>",
"final_url": "<string>",
"description_1": "<string>",
"description_2": "<string>",
"final_mobile_url": "<string>"
}
],
"callouts": [
{
"callout_text": "<string>"
}
],
"phone": {
"phone_number": "<string>",
"country_code": "<string>"
},
"structured_snippets": [
{
"values": [
"<string>"
]
}
]
}
}
'import requests
url = "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions"
payload = { "extensions": {
"sitelinks": [
{
"link_text": "<string>",
"final_url": "<string>",
"description_1": "<string>",
"description_2": "<string>",
"final_mobile_url": "<string>"
}
],
"callouts": [{ "callout_text": "<string>" }],
"phone": {
"phone_number": "<string>",
"country_code": "<string>"
},
"structured_snippets": [{ "values": ["<string>"] }]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
extensions: {
sitelinks: [
{
link_text: '<string>',
final_url: '<string>',
description_1: '<string>',
description_2: '<string>',
final_mobile_url: '<string>'
}
],
callouts: [{callout_text: '<string>'}],
phone: {phone_number: '<string>', country_code: '<string>'},
structured_snippets: [{values: ['<string>']}]
}
})
};
fetch('http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'extensions' => [
'sitelinks' => [
[
'link_text' => '<string>',
'final_url' => '<string>',
'description_1' => '<string>',
'description_2' => '<string>',
'final_mobile_url' => '<string>'
]
],
'callouts' => [
[
'callout_text' => '<string>'
]
],
'phone' => [
'phone_number' => '<string>',
'country_code' => '<string>'
],
'structured_snippets' => [
[
'values' => [
'<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions"
payload := strings.NewReader("{\n \"extensions\": {\n \"sitelinks\": [\n {\n \"link_text\": \"<string>\",\n \"final_url\": \"<string>\",\n \"description_1\": \"<string>\",\n \"description_2\": \"<string>\",\n \"final_mobile_url\": \"<string>\"\n }\n ],\n \"callouts\": [\n {\n \"callout_text\": \"<string>\"\n }\n ],\n \"phone\": {\n \"phone_number\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"structured_snippets\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"extensions\": {\n \"sitelinks\": [\n {\n \"link_text\": \"<string>\",\n \"final_url\": \"<string>\",\n \"description_1\": \"<string>\",\n \"description_2\": \"<string>\",\n \"final_mobile_url\": \"<string>\"\n }\n ],\n \"callouts\": [\n {\n \"callout_text\": \"<string>\"\n }\n ],\n \"phone\": {\n \"phone_number\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"structured_snippets\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"extensions\": {\n \"sitelinks\": [\n {\n \"link_text\": \"<string>\",\n \"final_url\": \"<string>\",\n \"description_1\": \"<string>\",\n \"description_2\": \"<string>\",\n \"final_mobile_url\": \"<string>\"\n }\n ],\n \"callouts\": [\n {\n \"callout_text\": \"<string>\"\n }\n ],\n \"phone\": {\n \"phone_number\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"structured_snippets\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"draft": {
"id": 123,
"name": "<string>",
"google_ads_customer_id": 123,
"date_added": "2023-11-07T05:31:56Z",
"date_updated": "2023-11-07T05:31:56Z",
"market_analysis_id": 123,
"campaign_name": "<string>",
"website_url": "<string>",
"daily_budget_micros": 123,
"bidding_strategy": {
"target_cpa_micros": 123,
"target_roas": 1,
"max_cpc_bid_ceiling_micros": 123
},
"default_match_type": "PHRASE",
"language_ids": [
123
],
"location_targets": [
{
"geo_target_constant_id": 123,
"target_type": "INCLUDE"
}
],
"network_settings": {
"target_google_search": true,
"target_search_network": false,
"target_content_network": false
},
"ad_schedule": {
"schedule_entries": [
{
"start_hour": 11,
"end_hour": 12,
"start_minute": 0,
"end_minute": 0
}
]
},
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"conversion_goals": [
{
"conversion_action_id": 1
}
],
"extensions": {
"sitelinks": [
{
"link_text": "<string>",
"final_url": "<string>",
"description_1": "<string>",
"description_2": "<string>",
"final_mobile_url": "<string>"
}
],
"callouts": [
{
"callout_text": "<string>"
}
],
"phone": {
"phone_number": "<string>",
"country_code": "<string>"
},
"structured_snippets": [
{
"values": [
"<string>"
]
}
]
},
"ad_groups_task_id": "<string>",
"ad_groups_generation_status": "completed",
"ad_groups_generation_error": "<string>",
"extensions_task_id": "<string>",
"extensions_generation_status": "not_started",
"extensions_generation_error": "<string>",
"is_published": false,
"published_at": "2023-11-07T05:31:56Z",
"published_campaign_id": 123,
"all_rsas_generated": false,
"ad_groups": [
{
"id": 123,
"name": "<string>",
"cpc_bid_micros": 25000000000,
"keywords": [
{
"id": 123,
"text": "<string>",
"cpc_bid_micros": 25000000000,
"final_url": "<string>",
"source_market_analysis_keyword_id": 123
}
],
"rsas": [
{
"id": 123,
"ad_group_id": 123,
"headlines": [
{
"text": "<string>",
"reason": "<string>"
}
],
"descriptions": [
{
"text": "<string>",
"reason": "<string>"
}
],
"final_url": "<string>",
"final_mobile_url": "<string>",
"display_path_1": "<string>",
"display_path_2": "<string>",
"tracking_url_template": "<string>",
"generation_status": "pending",
"generation_task_id": "<string>",
"generation_error": "<string>"
}
]
}
]
},
"warnings": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Campaigns
Update extensions (step 4)
Partial update of extensions on a draft.
Returns the full refreshed draft plus any validation warnings for this step.
PATCH
/
api
/
v1
/
campaigns
/
drafts
/
{draft_id}
/
extensions
Update extensions (step 4)
curl --request PATCH \
--url http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"extensions": {
"sitelinks": [
{
"link_text": "<string>",
"final_url": "<string>",
"description_1": "<string>",
"description_2": "<string>",
"final_mobile_url": "<string>"
}
],
"callouts": [
{
"callout_text": "<string>"
}
],
"phone": {
"phone_number": "<string>",
"country_code": "<string>"
},
"structured_snippets": [
{
"values": [
"<string>"
]
}
]
}
}
'import requests
url = "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions"
payload = { "extensions": {
"sitelinks": [
{
"link_text": "<string>",
"final_url": "<string>",
"description_1": "<string>",
"description_2": "<string>",
"final_mobile_url": "<string>"
}
],
"callouts": [{ "callout_text": "<string>" }],
"phone": {
"phone_number": "<string>",
"country_code": "<string>"
},
"structured_snippets": [{ "values": ["<string>"] }]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
extensions: {
sitelinks: [
{
link_text: '<string>',
final_url: '<string>',
description_1: '<string>',
description_2: '<string>',
final_mobile_url: '<string>'
}
],
callouts: [{callout_text: '<string>'}],
phone: {phone_number: '<string>', country_code: '<string>'},
structured_snippets: [{values: ['<string>']}]
}
})
};
fetch('http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'extensions' => [
'sitelinks' => [
[
'link_text' => '<string>',
'final_url' => '<string>',
'description_1' => '<string>',
'description_2' => '<string>',
'final_mobile_url' => '<string>'
]
],
'callouts' => [
[
'callout_text' => '<string>'
]
],
'phone' => [
'phone_number' => '<string>',
'country_code' => '<string>'
],
'structured_snippets' => [
[
'values' => [
'<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions"
payload := strings.NewReader("{\n \"extensions\": {\n \"sitelinks\": [\n {\n \"link_text\": \"<string>\",\n \"final_url\": \"<string>\",\n \"description_1\": \"<string>\",\n \"description_2\": \"<string>\",\n \"final_mobile_url\": \"<string>\"\n }\n ],\n \"callouts\": [\n {\n \"callout_text\": \"<string>\"\n }\n ],\n \"phone\": {\n \"phone_number\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"structured_snippets\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"extensions\": {\n \"sitelinks\": [\n {\n \"link_text\": \"<string>\",\n \"final_url\": \"<string>\",\n \"description_1\": \"<string>\",\n \"description_2\": \"<string>\",\n \"final_mobile_url\": \"<string>\"\n }\n ],\n \"callouts\": [\n {\n \"callout_text\": \"<string>\"\n }\n ],\n \"phone\": {\n \"phone_number\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"structured_snippets\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/extensions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"extensions\": {\n \"sitelinks\": [\n {\n \"link_text\": \"<string>\",\n \"final_url\": \"<string>\",\n \"description_1\": \"<string>\",\n \"description_2\": \"<string>\",\n \"final_mobile_url\": \"<string>\"\n }\n ],\n \"callouts\": [\n {\n \"callout_text\": \"<string>\"\n }\n ],\n \"phone\": {\n \"phone_number\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"structured_snippets\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"draft": {
"id": 123,
"name": "<string>",
"google_ads_customer_id": 123,
"date_added": "2023-11-07T05:31:56Z",
"date_updated": "2023-11-07T05:31:56Z",
"market_analysis_id": 123,
"campaign_name": "<string>",
"website_url": "<string>",
"daily_budget_micros": 123,
"bidding_strategy": {
"target_cpa_micros": 123,
"target_roas": 1,
"max_cpc_bid_ceiling_micros": 123
},
"default_match_type": "PHRASE",
"language_ids": [
123
],
"location_targets": [
{
"geo_target_constant_id": 123,
"target_type": "INCLUDE"
}
],
"network_settings": {
"target_google_search": true,
"target_search_network": false,
"target_content_network": false
},
"ad_schedule": {
"schedule_entries": [
{
"start_hour": 11,
"end_hour": 12,
"start_minute": 0,
"end_minute": 0
}
]
},
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"conversion_goals": [
{
"conversion_action_id": 1
}
],
"extensions": {
"sitelinks": [
{
"link_text": "<string>",
"final_url": "<string>",
"description_1": "<string>",
"description_2": "<string>",
"final_mobile_url": "<string>"
}
],
"callouts": [
{
"callout_text": "<string>"
}
],
"phone": {
"phone_number": "<string>",
"country_code": "<string>"
},
"structured_snippets": [
{
"values": [
"<string>"
]
}
]
},
"ad_groups_task_id": "<string>",
"ad_groups_generation_status": "completed",
"ad_groups_generation_error": "<string>",
"extensions_task_id": "<string>",
"extensions_generation_status": "not_started",
"extensions_generation_error": "<string>",
"is_published": false,
"published_at": "2023-11-07T05:31:56Z",
"published_campaign_id": 123,
"all_rsas_generated": false,
"ad_groups": [
{
"id": 123,
"name": "<string>",
"cpc_bid_micros": 25000000000,
"keywords": [
{
"id": 123,
"text": "<string>",
"cpc_bid_micros": 25000000000,
"final_url": "<string>",
"source_market_analysis_keyword_id": 123
}
],
"rsas": [
{
"id": 123,
"ad_group_id": 123,
"headlines": [
{
"text": "<string>",
"reason": "<string>"
}
],
"descriptions": [
{
"text": "<string>",
"reason": "<string>"
}
],
"final_url": "<string>",
"final_mobile_url": "<string>",
"display_path_1": "<string>",
"display_path_2": "<string>",
"tracking_url_template": "<string>",
"generation_status": "pending",
"generation_task_id": "<string>",
"generation_error": "<string>"
}
]
}
]
},
"warnings": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Body
application/json
Request schema for PATCH /drafts/{id}/extensions.
All extensions configuration.
Show child attributes
Show child attributes
Response
Successful Response
⌘I