Endpoints operasi kampanye iklan Meta — Campaigns, Ad Sets, Ads. Memungkinkan dazo-whitelist mengontrol status & budget iklan Facebook secara real-time via API engine.
Semua endpoint di bawah middleware: auth:api, myapi .
GET /api/facebook/ad-accounts/{accId}/campaigns — Daftar kampanye
GET http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaignsCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request GET \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns ' - Method GET const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns "
response = requests . get ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns "
req , _ := http . NewRequest ( " GET " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " GET " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Ambil daftar kampanye iklan akun + insight.
Param Wajib Tipe accId✅ string date_preset❌ string (opsional)
Response
json Copy &# 123 ;
" status " : true ,
" data " : [
&# 123 ;
" id " : " 238491234567890 " ,
" name " : " Kampanye Promo " ,
" status " : " ACTIVE " ,
" objective " : " OUTCOME_TRAFFIC " ,
" daily_budget " : 100000 ,
" insights " : &# 123 ; " reach " : 1200 , " spend " : 45000 &# 125 ;
&# 125 ;
]
&# 125 ;
GET /api/facebook/ad-accounts/{accId}/adsets — Daftar ad set
GET http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsetsCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request GET \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets ' - Method GET const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets "
response = requests . get ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets "
req , _ := http . NewRequest ( " GET " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " GET " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Ambil daftar ad set + insight.
Param Wajib Tipe accId✅ string
GET /api/facebook/ad-accounts/{accId}/ads — Daftar iklan
GET http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request GET \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads ' - Method GET const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads "
response = requests . get ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads "
req , _ := http . NewRequest ( " GET " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " GET " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Ambil daftar iklan spesifik + insight.
Param Wajib Tipe accId✅ string
Status update
POST /api/facebook/ad-accounts/{accId}/campaigns/{id}/status
POST http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/statusCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request POST \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status ' - Method POST const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status "
response = requests . post ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status "
req , _ := http . NewRequest ( " POST " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/status " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " POST " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Update status campaign (ACTIVE / PAUSED).
Request body
Field Wajib Tipe Nilai status✅ string ACTIVE / PAUSED
POST /api/facebook/ad-accounts/{accId}/adsets/{id}/status
POST http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/statusCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request POST \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status ' - Method POST const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status "
response = requests . post ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status "
req , _ := http . NewRequest ( " POST " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/status " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " POST " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Update status ad set (ACTIVE / PAUSED).
POST /api/facebook/ad-accounts/{accId}/ads/{id}/status
POST http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/statusCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request POST \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status ' - Method POST const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status "
response = requests . post ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status "
req , _ := http . NewRequest ( " POST " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/ads/:adId/status " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " POST " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Update status ad (ACTIVE / PAUSED).
Contoh status update
bash Copy curl -X POST " http://127.0.0.1:8081/api/facebook/ad-accounts/act_123/campaigns/238491234567890/status " \
-H " Authorization: Bearer <token> " \
-H " public-key: <public_key> " \
-H " Content-Type: application/json " \
-d ' {"status":"PAUSED"} '
json Copy &# 123 ; " status " : true , " data " : &# 123 ; " success " : true &# 125 ; &# 125 ;
Budget update
POST /api/facebook/ad-accounts/{accId}/campaigns/{id}/budget
POST http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budgetCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request POST \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget ' - Method POST const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget "
response = requests . post ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget "
req , _ := http . NewRequest ( " POST " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/campaigns/:campaignId/budget " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " POST " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Update budget campaign (daily/lifetime).
Request body
Field Wajib Tipe Keterangan budget✅ number Besaran budget (Rupiah) budget_type✅ string daily / lifetime
POST /api/facebook/ad-accounts/{accId}/adsets/{id}/budget
POST http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budgetCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request POST \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget ' - Method POST const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget "
response = requests . post ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget "
req , _ := http . NewRequest ( " POST " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/adsets/:adSetId/budget " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " POST " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Update budget ad set (daily/lifetime).
Contoh budget update
bash Copy curl -X POST " http://127.0.0.1:8081/api/facebook/ad-accounts/act_123/campaigns/238491234567890/budget " \
-H " Authorization: Bearer <token> " \
-H " public-key: <public_key> " \
-H " Content-Type: application/json " \
-d ' {"budget":200000,"budget_type":"daily"} '
json Copy &# 123 ; " status " : true , " data " : &# 123 ; " success " : true &# 125 ; &# 125 ;
GET /api/facebook/ad-accounts/{accId}/active-campaigns-count — Jumlah campaign aktif
GET http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-countCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request GET \
--url http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count ' - Method GET const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count ' ;
const options = { method : ' GET ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count "
response = requests . get ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count "
req , _ := http . NewRequest ( " GET " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/ad-accounts/:accountId/active-campaigns-count " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " GET " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Hitung jumlah campaign aktif pada akun.
Response
json Copy &# 123 ;
" status " : true ,
" data " : &# 123 ; " active_campaigns_count " : 3 &# 125 ;
&# 125 ;
POST /api/facebook/insight_batch — Insight batched
Middleware: Publik (di luar grup auth:api,myapi — verifikasi bila butuh proteksi).
POST http://127.0.0.1:8081/api/facebook/insight_batchCopy URL
curl PowerShell JavaScript Node.js Python Go PHP Copy
curl --request POST \
--url http://127.0.0.1:8081/api/facebook/insight_batch $ response = Invoke-WebRequest - Uri ' http://127.0.0.1:8081/api/facebook/insight_batch ' - Method POST const url = ' http://127.0.0.1:8081/api/facebook/insight_batch ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} const fetch = require ( ' node-fetch ' );
const url = ' http://127.0.0.1:8081/api/facebook/insight_batch ' ;
const options = { method : ' POST ' };
try {
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );
} catch ( error ) {
console . error ( error );
} import requests
url = " http://127.0.0.1:8081/api/facebook/insight_batch "
response = requests . post ( url )
print ( response . json ()) package main
import (
" fmt "
" net/http "
" io "
)
func main () {
url := " http://127.0.0.1:8081/api/facebook/insight_batch "
req , _ := http . NewRequest ( " POST " , url , nil )
res , _ := http . DefaultClient . Do ( req )
defer res . Body . Close ()
body , _ := io . ReadAll ( res . Body )
fmt . Println ( res )
fmt . Println ( string ( body ))
} <? php
$ curl = curl_init ();
curl_setopt_array ($ curl , [
CURLOPT_PORT => " 8081 " ,
CURLOPT_URL => " http://127.0.0.1:8081/api/facebook/insight_batch " ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => " POST " ,
]);
$ response = curl_exec ($ curl );
$ err = curl_error ($ curl );
curl_close ($ curl );
if ($ err ) {
echo " cURL Error #: " . $ err ;
} else {
echo $ response ;
}
Ambil insight batch multi-akun dalam satu request.
Request body
Field Wajib Tipe account_ids✅ array date_preset❌ string
Response
json Copy &# 123 ;
" status " : true ,
" data " : [
&# 123 ; " account_id " : " act_123 " , " insights " : &# 123 ; " spend " : 50000 &# 125 ; &# 125 ;
]
&# 125 ;
insight_batch is public Route POST /api/facebook/insight_batch berada di luar grup middleware auth:api,myapi di routes/api.php — dianggap publik . Verifikasi kebutuhan proteksi sebelum mengenalkan endpoint ini ke integrasi yang mengekspos insight sensitif.
GET /api/facebook/ad-accounts/{accId}/insight — (alternatif)
Beberapa klien memanggil POST /api/account/insight untuk insight tunggal akun. Lihat Spend Cap & Balance .
Ringkasan endpoint
Method Endpoint Fungsi GET /api/facebook/ad-accounts/{accId}/campaignsList campaign + insight GET /api/facebook/ad-accounts/{accId}/adsetsList ad set + insight GET /api/facebook/ad-accounts/{accId}/adsList ad + insight POST /api/facebook/ad-accounts/{accId}/campaigns/{id}/statusStatus campaign POST /api/facebook/ad-accounts/{accId}/adsets/{id}/statusStatus ad set POST /api/facebook/ad-accounts/{accId}/ads/{id}/statusStatus ad POST /api/facebook/ad-accounts/{accId}/campaigns/{id}/budgetBudget campaign POST /api/facebook/ad-accounts/{accId}/adsets/{id}/budgetBudget ad set GET /api/facebook/ad-accounts/{accId}/active-campaigns-countHitung campaign aktif POST /api/facebook/insight_batchInsight batch (public)
Error umum
Pesan Kondisi (#100) Param status must be ACTIVE or PAUSEDNilai status tidak valid (#100) Budget must be >= ...Budget di bawah minimum Meta Graph returned an error: (#17) User request limit reachedMeta rate limit — jeda operasi massal
Langkah berikutnya