Batch Requests for Insights on Facebook Marketing API (JAVA) -
this should easy looking @ fb documentation marketing api page empty: https://developers.facebook.com/docs/marketing-api/asyncrequests/v2.10
does has simple example on how make easy batch request adsinsights ads, adsets or campaigns?
googling around find examples in js or python, can't seem find right class name in java this.
ok, got working. code in scala should same in java.
implicit val batch = new batchrequest(facebookapi.context) apinodelist.asscala.map(getinsights) def getinsights(node: ad)(implicit data: insightdata, batch: batchrequest) = { node.getinsights .setbreakdowns(data.breakdowns) .setdatepreset(data.datepreset.tostring) .setfields(data.fields) .setactionattributionwindows(data.attributionwindow) .settimeincrement(data.timeincrement) .addtobatch(batch) } val result = batch.execute()
Comments
Post a Comment