Ads.getCampaignStats
From Facebook Developer Wiki
Contents |
Description
Note: This functionality is part of a limited beta program. If you’re interested in participating in the beta test, please contact your Facebook Advertising Account Manager. If you don’t yet have a Facebook Advertising Account Manager, you can request support at http://www.facebook.com/business/contact.php.
This API call is used to get basic campaign statistics over the time ranges specified.
Parameters
| Required | Name | Type | Description | |
| required | api_key | string | The application key associated with the calling application. If you specify the API key in your client, you don't need to pass it with every call. | |
|---|---|---|---|---|
| session_key | string | The session key of the logged in user. The session key is automatically included by our PHP client. | ||
| call_id | float | The request's sequence number. Each successive call for any session must use a sequence number greater than the last. We suggest using the current time in milliseconds, such as PHP's microtime(true) function. If you specify the call ID in your client, you don't need to pass it with every call. | ||
| sig | string | An MD5 hash of the current request and your secret key, as described in the How Facebook Authenticates Your Application. Facebook computes the signature for you automatically. | ||
| v | string | This must be set to 1.0 to use this version of the API. If you specify the version in your client, you don't need to pass it with every call. | ||
| account_id | int | The Facebook Ads account ID. The account ID must be one of the account IDs the session user can access. | ||
| campaign_ids | array | Specify an array of Campaign IDs to filter results otherwise specify null | ||
| include_deleted | bool | Toggle whether or not to retrieve stats from deleted Campaigns. | ||
| time_ranges | array | time_ranges is an array of JSON time_range strings that can be defined either using UNIX time or the month, day, year format. For example to indicate a range beginning 9/10/2009 and ending 9/13/2009 use the following {"time_range":{"day_start":{"month":9,"day":10,"year":2009},"day_stop":{"month":9,"day":13,"year":2009}}}time_range is {"time_start":1252537200,"time_stop":1252623600}time_start and time_stop to 0. To obtain stats from a certain time stamp to as recently as possible set time_stop to 0 and time_start to the desired value. | ||
| optional | No optional parameters |
Example Requests
$facebook->api_client->ads_updateCampaigns(987654,[{"campaign_id":123456,"daily_budget":5000}])
Response
NEED RESPONSE
Error Codes
| Code | Description | |
| 1 | An unknown error occurred. Please resubmit the request. | |
|---|---|---|
| 4 | The application has reached the maximum number of requests allowed. More requests are allowed once the time window has completed. | |
| 100 | One of the parameters specified was missing or invalid. | |
| 200 | Permissions error. | |
| 801 | Data quota exceeded. | |
| 805 | Database error. |
