java调用google dfp api

google dfp系统(Doubleclick for Publishers)是google为广告发布商提供的一个免费的广告管理工具,公司目前在用这个系统,由于操作比较频繁,所以想把操作放到我们自己的系统中,我们通过api去调用它们的dfp系统,原来以为google没有发布这样的api,后来一找,发现还真有,而且非常详细,看了下网络上没有对这个api的中文介绍,所以本来写个博客,介绍一下,由于官方api介绍的非常详细,我这里只告诉大家链接地址,具体的大家可以自己去砍。

1 google dfp api for java的地址:http://code.google.com/p/google-api-dfp-java/

点击Downloads标签,可以下载到最新的代码,

2 api的快速入门:https://developers.google.com/doubleclick-publishers/docs/start

这里面有各个语言的调用示例,比如java的,就如下:

DfpUser user = new DfpUser (email, password, networkCode, applicationName);
InventoryServiceInterface inventoryService = user.getService(DfpService.V201204.INVENTORY_SERVICE);
// Build the statement to retrieve all ad units
Statement statement = new Statement();
statement.setQuery("LIMIT 500");

// Retrieve all ad units.
AdUnitPage page = inventoryService.getAdUnitsByStatement(statement);

// Display all ad units.
if (page.getResults() != null) {
  for (AdUnit adUnit : page.getResults()) {
    System.out.println("Ad unit with id \"" + adUnit.getId()
        + "\" and name \"" + adUnit.getName() + "\".");
  }
} else {
  System.out.println("No results found.");
}

3 java api调用的各个example:http://code.google.com/p/google-api-dfp-java/source/browse/trunk#trunk/examples

这里面有非常详细的调用例子,包括广告单元、显示位置、订单等等的,应有尽有,大家可以参考

4 详细的文档说明:https://developers.google.com/doubleclick-publishers/

这里有详细的介绍,不过只有英文哦,呵呵


发布了109 篇原创文章 · 获赞 43 · 访问量 139万+

猜你喜欢

转载自blog.csdn.net/leidengyan/article/details/7616667