Facebook API : Empty Result for Ad Leads










1















I am building a PHP script based on Facebook Marketing API,



The API system works fine,



I can get the result for the campaigns, the ads, and full insights as well.



But, I want to get the result of the leads.



Note (1): I got admin access to the APP, the Ad account, and the page as well,



Note (2): App Status: In Development



Note (3) : I send the API request for "leads_retrieval" and "leads_retrieval",



$permissions = ['email','public_profile','leads_retrieval','ads_management', 'ads_read', 'business_management', 'read_audience_network_insights', 'read_insights', 'manage_pages', 'pages_show_list', 'pages_manage_cta','pages_manage_instant_articles', 'publish_pages', 'read_page_mailboxes'];


My Code to get the lead result :



$ad = new Ad('<AD_ID>');
$leads = $ad->getLeads();
$lead = $leads->getResponse()->getBody();

print_r($lead);


Result:



"data":


So for some reason, I still get the incorrect empty result for the leads!



Any idea about how to get the correct lead result for the Ad?



Reference : https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/v2.9










share|improve this question
























  • You could try to inspect with the debug token utility if the token have the proper permision

    – Matteo
    Nov 15 '18 at 18:41











  • @Matteo : could you please write a full reply with a code sample for the debug token in this case ?

    – m500500
    Nov 17 '18 at 19:18











  • hi! You can try to debug the Access Token using the Access Token Debugger Only for double check the token have the proper permission (This is not a real answer so I post as comment)

    – Matteo
    Nov 19 '18 at 7:33















1















I am building a PHP script based on Facebook Marketing API,



The API system works fine,



I can get the result for the campaigns, the ads, and full insights as well.



But, I want to get the result of the leads.



Note (1): I got admin access to the APP, the Ad account, and the page as well,



Note (2): App Status: In Development



Note (3) : I send the API request for "leads_retrieval" and "leads_retrieval",



$permissions = ['email','public_profile','leads_retrieval','ads_management', 'ads_read', 'business_management', 'read_audience_network_insights', 'read_insights', 'manage_pages', 'pages_show_list', 'pages_manage_cta','pages_manage_instant_articles', 'publish_pages', 'read_page_mailboxes'];


My Code to get the lead result :



$ad = new Ad('<AD_ID>');
$leads = $ad->getLeads();
$lead = $leads->getResponse()->getBody();

print_r($lead);


Result:



"data":


So for some reason, I still get the incorrect empty result for the leads!



Any idea about how to get the correct lead result for the Ad?



Reference : https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/v2.9










share|improve this question
























  • You could try to inspect with the debug token utility if the token have the proper permision

    – Matteo
    Nov 15 '18 at 18:41











  • @Matteo : could you please write a full reply with a code sample for the debug token in this case ?

    – m500500
    Nov 17 '18 at 19:18











  • hi! You can try to debug the Access Token using the Access Token Debugger Only for double check the token have the proper permission (This is not a real answer so I post as comment)

    – Matteo
    Nov 19 '18 at 7:33













1












1








1








I am building a PHP script based on Facebook Marketing API,



The API system works fine,



I can get the result for the campaigns, the ads, and full insights as well.



But, I want to get the result of the leads.



Note (1): I got admin access to the APP, the Ad account, and the page as well,



Note (2): App Status: In Development



Note (3) : I send the API request for "leads_retrieval" and "leads_retrieval",



$permissions = ['email','public_profile','leads_retrieval','ads_management', 'ads_read', 'business_management', 'read_audience_network_insights', 'read_insights', 'manage_pages', 'pages_show_list', 'pages_manage_cta','pages_manage_instant_articles', 'publish_pages', 'read_page_mailboxes'];


My Code to get the lead result :



$ad = new Ad('<AD_ID>');
$leads = $ad->getLeads();
$lead = $leads->getResponse()->getBody();

print_r($lead);


Result:



"data":


So for some reason, I still get the incorrect empty result for the leads!



Any idea about how to get the correct lead result for the Ad?



Reference : https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/v2.9










share|improve this question
















I am building a PHP script based on Facebook Marketing API,



The API system works fine,



I can get the result for the campaigns, the ads, and full insights as well.



But, I want to get the result of the leads.



Note (1): I got admin access to the APP, the Ad account, and the page as well,



Note (2): App Status: In Development



Note (3) : I send the API request for "leads_retrieval" and "leads_retrieval",



$permissions = ['email','public_profile','leads_retrieval','ads_management', 'ads_read', 'business_management', 'read_audience_network_insights', 'read_insights', 'manage_pages', 'pages_show_list', 'pages_manage_cta','pages_manage_instant_articles', 'publish_pages', 'read_page_mailboxes'];


My Code to get the lead result :



$ad = new Ad('<AD_ID>');
$leads = $ad->getLeads();
$lead = $leads->getResponse()->getBody();

print_r($lead);


Result:



"data":


So for some reason, I still get the incorrect empty result for the leads!



Any idea about how to get the correct lead result for the Ad?



Reference : https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/v2.9







php facebook api facebook-graph-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 8:10









Khalifa Nikzad

83213




83213










asked Nov 15 '18 at 7:02









m500500m500500

113




113












  • You could try to inspect with the debug token utility if the token have the proper permision

    – Matteo
    Nov 15 '18 at 18:41











  • @Matteo : could you please write a full reply with a code sample for the debug token in this case ?

    – m500500
    Nov 17 '18 at 19:18











  • hi! You can try to debug the Access Token using the Access Token Debugger Only for double check the token have the proper permission (This is not a real answer so I post as comment)

    – Matteo
    Nov 19 '18 at 7:33

















  • You could try to inspect with the debug token utility if the token have the proper permision

    – Matteo
    Nov 15 '18 at 18:41











  • @Matteo : could you please write a full reply with a code sample for the debug token in this case ?

    – m500500
    Nov 17 '18 at 19:18











  • hi! You can try to debug the Access Token using the Access Token Debugger Only for double check the token have the proper permission (This is not a real answer so I post as comment)

    – Matteo
    Nov 19 '18 at 7:33
















You could try to inspect with the debug token utility if the token have the proper permision

– Matteo
Nov 15 '18 at 18:41





You could try to inspect with the debug token utility if the token have the proper permision

– Matteo
Nov 15 '18 at 18:41













@Matteo : could you please write a full reply with a code sample for the debug token in this case ?

– m500500
Nov 17 '18 at 19:18





@Matteo : could you please write a full reply with a code sample for the debug token in this case ?

– m500500
Nov 17 '18 at 19:18













hi! You can try to debug the Access Token using the Access Token Debugger Only for double check the token have the proper permission (This is not a real answer so I post as comment)

– Matteo
Nov 19 '18 at 7:33





hi! You can try to debug the Access Token using the Access Token Debugger Only for double check the token have the proper permission (This is not a real answer so I post as comment)

– Matteo
Nov 19 '18 at 7:33












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314049%2ffacebook-api-empty-result-for-ad-leads%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314049%2ffacebook-api-empty-result-for-ad-leads%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto