Showing posts with label dfp. Show all posts
Showing posts with label dfp. Show all posts

Friday, May 7, 2010

Taking a closer look at the Publisher Query Language and the future

Recently we launched v201004, and with that introduced the new Statement object which gives support for one of our top requested features - bind variables. In this blog post, we will take a closer look at the Publisher Query Language (PQL), Statements with bind variables, and what we have in store for the future.

Publisher Query Language

PQL plays a very significant role in the DFP API by providing the developer with a robust way of filtering which objects should be retrieved or modified before the request is completed. In other words, if you would like to retrieve only orders which are in the draft state, you could take one of two approaches. You could fetch all orders within your network and filter them one by one or instruct the server to only fetch orders in the draft state before returning all results. By doing the latter, the DFP API allows developers to create smaller and more direct requests, and, in turn, increases the efficiency of their code.

PQL has a very similar syntax to SQL, but does not include keywords such as SELECT or FROM; they are implied by the method which uses the PQL statement. The following piece of code constructs a Statement capable of fetching orders in the draft state and retrieves those orders:

  // Create a statement to only select orders in the
  // 'DRAFT' state.
  Statement filterStatement = new Statement();
  filterStatement.setQuery("WHERE status = 'DRAFT' LIMIT 500");
  OrderPage orderPage =
      orderService.getOrdersByStatemet(filterStatement);

The documentation included for each "get*ByStatment" (e.g. getOrdersByStatement) method indicates which PQL fields map to which object properties.

Paging

The result for "get*ByStatment" calls are pages specific to the service; i.e. an OrderPage is returned by getOrdersByStatement. The limit for the number of objects that can be fetched for a single PQL request, and in a single Page, is 500. Because of this, you should always include LIMIT 500 in your statement. However, if you would like to fetch more than 500 objects, you will need to page through the results by including an OFFSET <#> in your statement as well. To page through orders in groups of 500, for example, in your statement, you would include LIMIT 500 as well as an OFFSET of an interval of 500.

This can be represented by the following code:

Monday, February 22, 2010

Introducing Google's DoubleClick For Publishers API

Today, we announced the next generation of our ad serving technology for online publishers, the new DoubleClick for Publishers (DFP) from Google. I am pleased to announce that the new version of DFP comes with a modern API that enables publishers and third-parties to customize and extend the product.

As we mentioned in our Google blog post, for the past few years, we've been investing in a suite of solutions — AdSense, ad-serving technology and the DoubleClick Ad Exchange — to help online publishers make the most money possible from their content, whether they sell advertising through their own sales force directly, through an ad network such as AdSense, or a combination of both. We saw an opportunity to improve these solutions by combining Google's technology and infrastructure with DoubleClick's display advertising and ad serving experience. The new DoubleClick for Publishers is a result of that combination of strengths, as is the API that comes with it.

The new API is available to publishers who use DFP, as well as to third-parties and vendors who would like to build applications on top of DFP. A growing community of developers is already working on sales, order management, workflow and data visualization tools. We've incorporated feedback on the existing DART for Publishers API and believe the new API is a significant step forward. It uses SOAP, a standard and widely-adopted messaging technology that uses HTTP requests to transmit and receive XML data between your client and our servers. This means you can use it with virtually any programming language of your choice. We have a wealth of public documentation available online and there are numerous code samples and client libraries ready for you to download.

To learn more about the new API, there are a few places to get started:

The Google Code site that hosts all of the documentation for the new API:

http://code.google.com/apis/dfp

The Google Groups forum where we provide support and where you can provide feedback to us:

http://groups.google.com/group/google-doubleclick-for-publishers-api/

This blog, which will continue to have posts explaining new API features, discussing best practices for development, and alerting developers of planned outages.

When you are ready to begin development, please sign up to receive access to a sandbox development environment. In this environment, you will be able to explore the API without worrying about affecting your production accounts. API access to production DFP accounts is being rolled out in waves to customers who have used the sandbox environment and will be granted as resources allow. Please start your development effort using the sandbox environment now. You'll be able to contact us when your application is ready to test in the production environment through a new sign-up form that will appear on our online documentation and on our blog.

We are looking forward to working with you and seeing what you build!