Facebook developer blog

User login

Facebook Connect


Subscribe to our feed

Facebook news from across the web

Updated: 7 min 1 sec ago

Wed, 10/08/2011 - 4:30pm

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 ''; ?>

More details on AdGroup creation and updates .

Releasing Power Editor

We are also releasing the source code of the Power Editor, our ad management tool, built using the Ads API. You can access it here. In addition to serving as a sample app, we think that some of you will build tools that are even better and more advanced. We will continue to add new features to the Power Editor as we continue to iterate on the Ads API.

Please let us know if you have any questions or feedback in the comments below.

Categories: Facebook

Wed, 10/08/2011 - 11:00am

As , we are continuing to release new features that address feedback that we have heard from you as part of Operation Developer Love.

Today we are announcing the ability to add and create Facebook Groups within the to manage users who are Administrators, Developers, Insights Users, and Testers in your app. With this feature, adding users to a role across different apps has become much simpler. For example, you may have a QA team to test your apps. Instead of having to repeatedly add the QA team users as Testers on each app, you can now create a “QA team” Group from the Developer App with these users and add this Group to the “Tester” section.

To get started, go to the Roles page on the . Click the “Add” link in the (Administrators, Developers, Testers, Insights Users) to add a Group.

After clicking on the “Add” link, the dialog below appears where you can type in the name of a closed or secret Group that you admin.

You can also click on the link in the dialog (i.e., Create a Group for Testers) to create a new Group. On the “Create Group” dialog, you can specify the Group name, members, and privacy (Closed or Secret). To learn more about Facebook Group settings, click . If you create a Group, you are automatically added as the Group Admin.

After adding or creating a Group, you will see the Group (e.g., QA Team) appear in the appropriate section:

Whenever a Group is added to a role for an app, an email is sent to the Update Notification email (found in the Security section of the Advanced tab) and group members will also receive a notification on Facebook that a post has been made to the Group.

Clicking on the notification will take you into the Group where the recently added role (e.g., Testers) and app (e.g., New Test) are posted.

We have started making these features available in the to a small set of developers today and plan to make them available to all developers over the next week. We look forward to your feedback and questions in the comments below.

Categories: Facebook

Tue, 09/08/2011 - 8:00pm

As communicated on our , the PHP SDK has been updated to version 3.1.1 to leverage recent changes to the . The JavaScript SDK sets a cookie that identifies the connected user (if the cookie parameter is set to true). The PHP SDK can easily access this cookie when used in the same domain. This allows you to connect the user to your site or app using the JavaScript SDK (FB.login or the ) and then call Platform APIs from server-side PHP without doing additional work.

The example below shows how the PHP SDK and work together: 'YOUR_APP_ID', 'secret' => 'YOUR_APP_SECRET', )); // See if there is a user from a cookie $user = $facebook->getUser(); if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { echo '

'.htmlspecialchars(print_r($e, true)).'
'; $user = null; } } ?> Your user profile is

Reminder: Migrate to OAuth 2.0 and HTTPS by October 1, 2011

With this update to the PHP SDK, all apps can now easily migrate to OAuth 2.0.

By October 1, 2011, we require that all website and canvas apps must exclusively support OAuth 2.0 (draft 20). All canvas apps must use the parameter. This also implies that old, previous versions of our SDKs will stop working, including the old JavaScript SDK.

You can ensure that you have migrated by:

  • Implementing the OAuth 2.0 authentication system. For more details, please see our Authentication Guide.
  • Using the latest SDKs (the and the PHP SDK v.3.1.1)
  • Enabling the OAuth migration in the Developer App to use the encrypted access token
  • For Canvas Apps, verifying that your app is using the parameter.

In addition, an SSL Certificate is required for all Canvas and Page Tab apps by October 1. Contrary to some feedback we’ve heard, acquiring an SSL certificate is relatively inexpensive, and the ongoing cost of supporting SSL for most apps is low. The sooner your app supports HTTPS the more secure our platform will become. A warning will be issued in the if you do not have the appropriate Secure URLs filled.

Please let us know if you have any questions or feedback in the Comments below.

Categories: Facebook

Our next event