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/

這裏有詳細的介紹,不過只有英文哦,呵呵


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章