Skip to main content
Create or update a Facebook campaign
PUT https://services.leadconnectorhq.com/ad-publishing/facebook/campaigns

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

id
string
default:"camp_123"
Campaign identifier
locationId
string
default:"loc_abc123"
required
Account identifier
name
string
default:"Summer Campaign"
Campaign name
objective
string
default:"LEAD_GENERATION"
Campaign objective Posibles valores: ‘OUTCOME_LEADS’, ‘OUTCOME_TRAFFIC’, ‘OUTCOME_ENGAGEMENT’, ‘OUTCOME_SALES’
specialAdCategories
string
Special ad categories Posibles valores: ‘EMPLOYMENT’, ‘CREDIT’, ‘FINANCIAL_PRODUCTS_SERVICES’, ‘HOUSING’, ‘ISSUES_ELECTIONS_POLITICS’, ‘ONLINE_GAMBLING_AND_GAMING’, ‘NONE’
source
string
default:"facebook"
Campaign data source

Respuestas

{}
{}
{}

Ejemplo

curl -X PUT 'https://services.leadconnectorhq.com/ad-publishing/facebook/campaigns' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "camp_123",
  "locationId": "loc_abc123",
  "name": "Summer Campaign",
  "objective": "LEAD_GENERATION",
  "specialAdCategories": "EMPLOYMENT",
  "source": "facebook"
}'
const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/campaigns', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id": "camp_123", "locationId": "loc_abc123", "name": "Summer Campaign", "objective": "LEAD_GENERATION", "specialAdCategories": "EMPLOYMENT", "source": "facebook"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'PUT',
    'https://services.leadconnectorhq.com/ad-publishing/facebook/campaigns',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"id": "camp_123", "locationId": "loc_abc123", "name": "Summer Campaign", "objective": "LEAD_GENERATION", "specialAdCategories": "EMPLOYMENT", "source": "facebook"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/facebook/campaigns');
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': 'camp_123', 'locationId': 'loc_abc123', 'name': 'Summer Campaign', 'objective': 'LEAD_GENERATION', 'specialAdCategories': 'EMPLOYMENT', 'source': 'facebook'}),
]);
$data = json_decode(curl_exec($ch), true);