Create or update a full Google Ads campaign structure
PUT https://services.leadconnectorhq.com/ad-publishing/google/ads
Autorización
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.
Body
name
string
default:"My Campaign"
required
Campaign name
locationId
string
default:"loc_abc123"
required
Account identifier
Advertising channel Posibles valores: ‘SEARCH’, ‘DISCOVERY’, ‘DISPLAY’, ‘HOTEL’, ‘LOCAL’, ‘MULTI_CHANNEL’, ‘PERFORMANCE_MAX’, ‘DEMAND_GEN’
advertisingChannelSubType
Channel sub type Posibles valores: ‘DEMAND_GEN’
Goal type Posibles valores: ‘WEBSITE_TRAFFIC’, ‘LEAD’
Campaign audience targeting
Campaign ad groups
Google ad group identifier
name
string
default:"Ad Group 1"
Ad group name
Ad content items
Media type Posibles valores: ‘IMAGE’, ‘VIDEO’, ‘CAROUSEL’
finalUrl
string
default:"https://example.com"
Final URL
Whether the ad is soft-deleted
Ad-level error message from Google
Ad publishing status Posibles valores: ‘DRAFT’, ‘SCHEDULED’, ‘PUBLISHED’, ‘PUBLISHING’, ‘FAILED’, ‘IN_REVIEW’, ‘PAUSED’, ‘ARCHIVED’, ‘WITH_ISSUES’, ‘REJECTED’
Google Ads ad resource ID
Ad media items
Media type Posibles valores: ‘IMAGE’
src
string
default:"https://example.com/image.jpg"
Media source URL
Error message if media failed
Image type classification
Call to action label Posibles valores: ‘AUTOMATED’, ‘LEARN_MORE’, ‘GET_QUOTE’, ‘APPLY_NOW’, ‘SIGN_UP’, ‘CONTACT_US’, ‘SUBSCRIBE’, ‘DOWNLOAD’, ‘BOOK_NOW’, ‘SHOP_NOW’, ‘BUY_NOW’, ‘DONATE_NOW’, ‘ORDER_NOW’, ‘PLAY_NOW’, ‘SEE_MORE’
businessName
string
default:"Acme Corp"
Business name
Carousel cards
finalUrl
string
default:"https://example.com"
Card final URL
Card media items
Media type Posibles valores: ‘IMAGE’
src
string
default:"https://example.com/image.jpg"
Media source URL
Error message if media failed
Image type classification
Ad group publishing status Posibles valores: ‘DRAFT’, ‘SCHEDULED’, ‘PUBLISHED’, ‘PUBLISHING’, ‘FAILED’, ‘IN_REVIEW’, ‘PAUSED’, ‘ARCHIVED’, ‘WITH_ISSUES’, ‘REJECTED’
Ad group-level error from Google
Google Ads ad group resource ID
Selected channel placements
Google audience resource ID
Ad group audience targeting
Ad schedule rules
Day of week Posibles valores: ‘FRIDAY’, ‘MONDAY’, ‘SATURDAY’, ‘SUNDAY’, ‘THURSDAY’, ‘TUESDAY’, ‘UNKNOWN’, ‘UNSPECIFIED’, ‘WEDNESDAY’, ‘ALL_DAYS’, ‘MONDAY_TO_FRIDAY’, ‘SATURDAY_AND_SUNDAY’
from
string
default:"09:00"
required
Start time (HH:MM)
to
string
default:"17:00"
required
End time (HH:MM)
Publishing status Posibles valores: ‘DRAFT’, ‘SCHEDULED’, ‘PUBLISHED’, ‘PUBLISHING’, ‘FAILED’, ‘IN_REVIEW’, ‘PAUSED’, ‘ARCHIVED’, ‘WITH_ISSUES’, ‘REJECTED’
Google Ad account identifier
Whether the campaign has unpublished changes
Maximum CPC bid in micros
Google Ads campaign resource ID
Respuestas
422 - Unprocessable Entity
Ejemplo
curl -X PUT 'https://services.leadconnectorhq.com/ad-publishing/google/ads' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"id": "string",
"name": "My Campaign",
"locationId": "loc_abc123",
"advertisingChannelType": "SEARCH",
"advertisingChannelSubType": "DEMAND_GEN",
"goalType": "WEBSITE_TRAFFIC",
"isEuPoliticalAds": false,
"adGroups": [
{
"id": "string",
"adGroupId": "string",
"name": "Ad Group 1",
"adCampaignId": "string",
"adContent": [
{}
],
"publishingStatus": "DRAFT",
"adGroupError": "string",
"googleAdGroupId": "string",
"customChannels": true,
"selectedChannels": [
"GMAIL"
],
"googleAudienceId": "string"
}
],
"adSchedule": [
{
"dayOfWeek": "FRIDAY",
"from": "09:00",
"to": "17:00"
}
],
"publishingStatus": "DRAFT",
"googleAdAccountId": "string",
"unpublishedChanges": true,
"maximumCpc": 0,
"googleCampaignId": "string",
"source": "WEBSITE",
"advancedOptions": {}
}'
const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/google/ads', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"id": "string", "name": "My Campaign", "locationId": "loc_abc123", "advertisingChannelType": "SEARCH", "advertisingChannelSubType": "DEMAND_GEN", "goalType": "WEBSITE_TRAFFIC", "isEuPoliticalAds": false, "adGroups": [{"id": "string", "adGroupId": "string", "name": "Ad Group 1", "adCampaignId": "string", "adContent": [{}], "publishingStatus": "DRAFT", "adGroupError": "string", "googleAdGroupId": "string", "customChannels": true, "selectedChannels": ["GMAIL"], "googleAudienceId": "string"}], "adSchedule": [{"dayOfWeek": "FRIDAY", "from": "09:00", "to": "17:00"}], "publishingStatus": "DRAFT", "googleAdAccountId": "string", "unpublishedChanges": true, "maximumCpc": 0, "googleCampaignId": "string", "source": "WEBSITE", "advancedOptions": {}}),
});
const data = await response.json();
import os, requests
response = requests.request(
'PUT',
'https://services.leadconnectorhq.com/ad-publishing/google/ads',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"id": "string", "name": "My Campaign", "locationId": "loc_abc123", "advertisingChannelType": "SEARCH", "advertisingChannelSubType": "DEMAND_GEN", "goalType": "WEBSITE_TRAFFIC", "isEuPoliticalAds": false, "adGroups": [{"id": "string", "adGroupId": "string", "name": "Ad Group 1", "adCampaignId": "string", "adContent": [{}], "publishingStatus": "DRAFT", "adGroupError": "string", "googleAdGroupId": "string", "customChannels": true, "selectedChannels": ["GMAIL"], "googleAudienceId": "string"}], "adSchedule": [{"dayOfWeek": "FRIDAY", "from": "09:00", "to": "17:00"}], "publishingStatus": "DRAFT", "googleAdAccountId": "string", "unpublishedChanges": true, "maximumCpc": 0, "googleCampaignId": "string", "source": "WEBSITE", "advancedOptions": {}},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/google/ads');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'id': 'string', 'name': 'My Campaign', 'locationId': 'loc_abc123', 'advertisingChannelType': 'SEARCH', 'advertisingChannelSubType': 'DEMAND_GEN', 'goalType': 'WEBSITE_TRAFFIC', 'isEuPoliticalAds': false, 'adGroups': [{'id': 'string', 'adGroupId': 'string', 'name': 'Ad Group 1', 'adCampaignId': 'string', 'adContent': [{}], 'publishingStatus': 'DRAFT', 'adGroupError': 'string', 'googleAdGroupId': 'string', 'customChannels': true, 'selectedChannels': ['GMAIL'], 'googleAudienceId': 'string'}], 'adSchedule': [{'dayOfWeek': 'FRIDAY', 'from': '09:00', 'to': '17:00'}], 'publishingStatus': 'DRAFT', 'googleAdAccountId': 'string', 'unpublishedChanges': true, 'maximumCpc': 0, 'googleCampaignId': 'string', 'source': 'WEBSITE', 'advancedOptions': {}}),
]);
$data = json_decode(curl_exec($ch), true);