Recently, we announced  the availability of native ads for apps in DFP . Here, we’re going to introduce you to creating native creatives with the DFP API using the ads Java client library . A native creative consists of a set of assets (headline, image, etc.) which are sent to mobile apps for custom rendering in their own code (see our Android  and iOS  developer guides for details).
Native creatives are actually just another type of template-based creative . While the DFP UI abstracts this, in the API you create a native creative using a TemplateCreative  with the system-defined native template ID. The creative template IDs available in your network can be retrieved by the getCreativeTemplatesByStatement  method in the CreativeTemplateService . You can also view these IDs in the UI under Delivery > Creatives > Native ad formats  (see the ID below each native ad format name in the table). The native app install template ID is 10004400.
    TemplateCreative nativeAppInstallCreative = new TemplateCreative();
    nativeAppInstallCreative.setCreativeTemplateId(10004400L);
 
Because native creatives do not have a predetermined size, you need to set a placeholder size of 1x1.
    Size size = new Size();
    size.setWidth(1);
    size.setHeight(1);
    size.setIsAspectRatio(false);
    nativeAppInstallCreative.setSize(size);
 
Finally, specify a name and destination URL; this example is for the Pie Noon app :
    nativeAppInstallCreative.setName("Pie Noon native ad");
    nativeAppInstallCreative.setDestinationUrl(
        "https://play.google.com/store/apps/details?id=com.google.fpl.pie_noon");
 
Settings specific to native creatives are set via template variables . An app install native creative requires the following unique template variable names to be set:
Headline 
Body 
Image 
Price 
Appicon 
Calltoaction 
Starrating 
Store 
DeeplinkclickactionURL 
 
Note that creative template variables are case sensitive and those of type AssetCreativeTemplateVariableValue  (“Image” and “Appicon”) must have a unique filename.
You can find the full Java example on how to create native creatives in our GitHub repository here . All of our other ads client libraries  have similar examples.
As always, if you have any questions, feel free to drop us a line on the DFP API forums  or the Ads Developer Google+ page .
Vincent Tsao , DFP API Team