We are excited to announce that the is now out of beta. The Ads API, part of the , allows you to build tools that help marketers scale their Facebook presence. Over the past several months, we have significantly improved the stability, reliability, and performance of the Ads API. Today, have been using the Marketing APIs to offer advanced functionality, provide comprehensive services to manage various Facebook products, and address custom needs for marketers.
If you are interested in applying for this open round of access to the Ads API, visit . While we consider all requests, we will continue to prioritize the partners most likely to build socially-focused apps that provide high value to marketers.
In order to continue improving scalability, performance and reliability, we are migrating the Ads API from the legacy REST API to the . This is a transition that many of you have requested. Some Ads API methods are in the Graph API today. We plan on completing the transition by January 2012 and will only add new features to the Graph API. Begin planning now to migrate your apps to the Graph API. In addition, we have updated to provide more transparency.
Getting Started with the Ads API
In order to use the Ads API (once accepted into the program), you must prompt the user for the ads_management .
After the user authorizes your app, you can make Graph API calls to access the user’s advertising account to manage Facebook Ads and Sponsored Stories.
The examples below demonstrate how to create a Page Like Sponsored Story: curl -F "campaign_id=6003417011234" -F "bid_type=1" -F "max_bid=30" -F "targeting={'countries':['US']}" -F "creative={‘type’:9,’object_id’:125772667501234}" -F "name=test" "https:///act_368811234/adgroups?access_token=____"
via PHP:
9, 'object_id'=>125772667501234); $targeting_spec = array( 'countries' => array('US')); $bid_type = 1; $max_bid=30; $name = 'test'; $account_id = 368811234; $campaign_id = 6003417011234; $access_token = 'access_token'; // POST to Graph API endpoint to create an Ad $graph_url= "https:///" . "act_". $account_id . "/adgroups?" . "campaign_id=" . $campaign_id . "&bid_type=" . $bid_type . "&max_bid=" . $max_bid . "&creative=" . json_encode($creative_spec) . "&targeting=" . json_encode($targeting_spec) . "&name=" . urlencode($name) . "&method=POST" . "&access_token=" .$access_token; echo($graph_url); echo ''; echo file_get_contents($graph_url); echo ''; ?>This examples below update a bid for an AdGroup
curl -F "max_bid=100" "https:///6003493971234?access_token=___"via PHP:
'; echo file_get_contents($graph_url); echo '