@JunQiu
2018-09-18T18:04:26.000000Z
字数 5130
阅读 1181
other
linux
summary_2018/06
mongodb
facebookApi简单使用
facebook广告架构
实践:
curl -X POST \
-F 'name=My campaign' \ //名字
-F 'objective=LINK_CLICKS' \ //广告目标:点击链接
-F 'status=PAUSED' \ //广告状态
-F 'access_token=<ACCESS_TOKEN>' \ //ACCESS_TOKEN
https://graph.facebook.com/v3.0/act_<AD_ACCOUNT_ID>/campaigns
//AD_ACCOUNT_ID:facebook account id
返回广告系列id:{ id: '120330000029077009' }
curl \
-F 'name=My Ad Set' \
-F 'optimization_goal=REACH' \
-F 'billing_event=IMPRESSIONS' \
-F 'bid_amount=2' \
-F 'daily_budget=1000' \
-F 'campaign_id=120330000029077009' \
-F 'targeting={"geo_locations":{"countries":["US"]}}' \
-F 'status=PAUSED' \
-F 'promoted_object={"page_id":""}' \
-F 'access_token=' \ //ACCESS_TOKEN
https://graph.facebook.com/v3.0/act_<AD_ACCOUNT_ID>/adsets
返回值:
返回广告组ID:{"id":"120330000029078409"}
curl \
-F "name=ad" \
-F 'status=ACTIVE' \
-F "adset_id=" \
-F "creative={'name': 'test-creative','body': 'test','image_hash': '','object_type': 'PAGE','object_id': ''}" \
-F "object_url=" \
-F "access_token=" \
"https://graph.facebook.com/v3.0/act_<AD_ACCOUNT_ID>/ads"
返回值广告ID:{"id":"120330000029078809"}
curl -G \
-d "date_preset=today" \
-d "access_token=" \
"https://graph.facebook.com/v3.0/120330000029077009/insights"
返回值:
{"data":[{"date_start":"2018-06-20","date_stop":"2018-06-20","impressions":"100","spend":"10","account_id":"101671007239408","campaign_id":"120330000029077009"}],"paging":{"cursors":{"before":"MAZDZD","after":"MAZDZD"}}}
db.getCollection("student").explain('allPlansExecution').find({id:'0101111'})
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "test.student",
"indexFilterSet" : false,
"parsedQuery" : {
"id" : {
"$eq" : "0101111"
}
},
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"id" : 1
},
"indexName" : "id_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"id" : [ ]
},
"isUnique" : true,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"id" : [
"[\"0101111\", \"0101111\"]"
]
}
}
},
"rejectedPlans" : [ ]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 1,
"executionTimeMillis" : 78,
"totalKeysExamined" : 1,
"totalDocsExamined" : 1,
"executionStages" : {
"stage" : "FETCH",
"nReturned" : 1,
"executionTimeMillisEstimate" : 0,
"works" : 2,
"advanced" : 1,
"needTime" : 0,
"needYield" : 0,
"saveState" : 0,
"restoreState" : 0,
"isEOF" : 1,
"invalidates" : 0,
"docsExamined" : 1,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"nReturned" : 1,
"executionTimeMillisEstimate" : 0,
"works" : 2,
"advanced" : 1,
"needTime" : 0,
"needYield" : 0,
"saveState" : 0,
"restoreState" : 0,
"isEOF" : 1,
"invalidates" : 0,
"keyPattern" : {
"id" : 1
},
"indexName" : "id_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"id" : [ ]
},
"isUnique" : true,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"id" : [
"[\"0101111\", \"0101111\"]"
]
},
"keysExamined" : 1,
"seeks" : 1,
"dupsTested" : 0,
"dupsDropped" : 0,
"seenInvalidated" : 0
}
},
"allPlansExecution" : [ ]
},
"serverInfo" : {
"host" : "T4F-MAM-13164.local",
"port" : 27017,
"version" : "3.6.5",
"gitVersion" : "a20ecd3e3a174162052ff99913bc2ca9a839d618"
},
"ok" : 1
}