Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve facebook user's ads account id?

In my app I want to create Facebook ads on behalf of a user. How do I discover via API if he has a FB Ads account and what's his Ads account id?

like image 779
RocketR Avatar asked Jul 23 '13 12:07

RocketR


2 Answers

Provided your app has access to the Ads API and you have the ads_management Permission you can retrieve the list of Advertising Accounts with a call to /<USER ID>/adaccounts

The response is an array of adaccount objects, documented here: https://developers.facebook.com/docs/reference/ads-api/adaccount/

like image 131
Igy Avatar answered Dec 07 '22 12:12

Igy


You can use the facebook graph explorer to discorever this informations. you must specify the fields to pass to the facebook graph explorer. Example :

https://graph.facebook.com/{user_id}?fields=id,name,adaccounts

Also you can find using this http://rubygems.org/gems/zuck to retrieve all adaccounts/ads/account_id that specific user, just remember that you must have sufficient permissions to read this information and also need a token that has not expired .

like image 45
Luiz Lai Avatar answered Dec 07 '22 12:12

Luiz Lai