Retrieving batch FB reactions from multiple posts











up vote
0
down vote

favorite












I managed to return the first page of my posts with some details including its ID with:



api = 'https://graph.facebook.com/v3.2/me'
key = 'secret'

payload = {'fields':'''
posts{permalink_url,created_time,admin_creator,message}'''
, 'access_token':key}

r = requests.get(api, params = payload)


In the FB Graph API documentation, you can do an API call like this /{object-id}/reactions, so now with the ID, getting the reactions is possible. But I need to get the reaction counts by type, so after some research, I find out that I will be able to chain the calls like below.



reactions.type(LIKE).limit(0).summary(1).as(LIKE),
reactions.type(LOVE).limit(0).summary(1).as(LOVE),
reactions.type(WOW).limit(0).summary(1).as(WOW),
reactions.type(HAHA).limit(0).summary(1).as(HAHA),
reactions.type(SAD).limit(0).summary(1).as(SAD),
reactions.type(ANGRY).limit(0).summary(1).as(ANGRY),
reactions.type(THANKFUL).limit(0).summary(1).as(THANKFUL)


Fine now everything is working, but after a pause, I realized that no way in FB will allow me to run those calls for each post especially after I get all the posts IDs since the beginning and sure enough it does not.



So there's this thing about batching as well where I tried to do, where I stacked multiple IDs;



fields=id,reactions.type(PRIDE).limit(0).summary(1),reactions.type(LIKE).limit(0).summary(1)&ids=id1,id2


but I get this instead;



"message": "Syntax error "Field reactions specified more than once. This is only possible before version 2.1" 


From here it is quite clear to me that FB does not allow specifying a field more than once but just doing reactions.limit(0).summary(1) just returns the total reactions, how am I able to retrieve the reactions from each post without having to bust the API. It gets more confusing as the APIs constantly change throughout time and now we have v3.2 and most of the methods I have researched on SO does not apply anymore.










share|improve this question
























  • Where did the .as(…) go?
    – misorude
    Nov 20 at 7:59










  • It seems the later APIs do not support aliases for certain endpoints so I removed them.
    – BernardL
    Nov 20 at 8:06










  • Works fine when I test it against v3.2
    – misorude
    Nov 20 at 8:13










  • Even for batching?
    – BernardL
    Nov 20 at 22:14










  • If by that you mean the ids=id1,id2 syntax (which isn’t really making batch requests), then Yes.
    – misorude
    Nov 22 at 7:21















up vote
0
down vote

favorite












I managed to return the first page of my posts with some details including its ID with:



api = 'https://graph.facebook.com/v3.2/me'
key = 'secret'

payload = {'fields':'''
posts{permalink_url,created_time,admin_creator,message}'''
, 'access_token':key}

r = requests.get(api, params = payload)


In the FB Graph API documentation, you can do an API call like this /{object-id}/reactions, so now with the ID, getting the reactions is possible. But I need to get the reaction counts by type, so after some research, I find out that I will be able to chain the calls like below.



reactions.type(LIKE).limit(0).summary(1).as(LIKE),
reactions.type(LOVE).limit(0).summary(1).as(LOVE),
reactions.type(WOW).limit(0).summary(1).as(WOW),
reactions.type(HAHA).limit(0).summary(1).as(HAHA),
reactions.type(SAD).limit(0).summary(1).as(SAD),
reactions.type(ANGRY).limit(0).summary(1).as(ANGRY),
reactions.type(THANKFUL).limit(0).summary(1).as(THANKFUL)


Fine now everything is working, but after a pause, I realized that no way in FB will allow me to run those calls for each post especially after I get all the posts IDs since the beginning and sure enough it does not.



So there's this thing about batching as well where I tried to do, where I stacked multiple IDs;



fields=id,reactions.type(PRIDE).limit(0).summary(1),reactions.type(LIKE).limit(0).summary(1)&ids=id1,id2


but I get this instead;



"message": "Syntax error "Field reactions specified more than once. This is only possible before version 2.1" 


From here it is quite clear to me that FB does not allow specifying a field more than once but just doing reactions.limit(0).summary(1) just returns the total reactions, how am I able to retrieve the reactions from each post without having to bust the API. It gets more confusing as the APIs constantly change throughout time and now we have v3.2 and most of the methods I have researched on SO does not apply anymore.










share|improve this question
























  • Where did the .as(…) go?
    – misorude
    Nov 20 at 7:59










  • It seems the later APIs do not support aliases for certain endpoints so I removed them.
    – BernardL
    Nov 20 at 8:06










  • Works fine when I test it against v3.2
    – misorude
    Nov 20 at 8:13










  • Even for batching?
    – BernardL
    Nov 20 at 22:14










  • If by that you mean the ids=id1,id2 syntax (which isn’t really making batch requests), then Yes.
    – misorude
    Nov 22 at 7:21













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I managed to return the first page of my posts with some details including its ID with:



api = 'https://graph.facebook.com/v3.2/me'
key = 'secret'

payload = {'fields':'''
posts{permalink_url,created_time,admin_creator,message}'''
, 'access_token':key}

r = requests.get(api, params = payload)


In the FB Graph API documentation, you can do an API call like this /{object-id}/reactions, so now with the ID, getting the reactions is possible. But I need to get the reaction counts by type, so after some research, I find out that I will be able to chain the calls like below.



reactions.type(LIKE).limit(0).summary(1).as(LIKE),
reactions.type(LOVE).limit(0).summary(1).as(LOVE),
reactions.type(WOW).limit(0).summary(1).as(WOW),
reactions.type(HAHA).limit(0).summary(1).as(HAHA),
reactions.type(SAD).limit(0).summary(1).as(SAD),
reactions.type(ANGRY).limit(0).summary(1).as(ANGRY),
reactions.type(THANKFUL).limit(0).summary(1).as(THANKFUL)


Fine now everything is working, but after a pause, I realized that no way in FB will allow me to run those calls for each post especially after I get all the posts IDs since the beginning and sure enough it does not.



So there's this thing about batching as well where I tried to do, where I stacked multiple IDs;



fields=id,reactions.type(PRIDE).limit(0).summary(1),reactions.type(LIKE).limit(0).summary(1)&ids=id1,id2


but I get this instead;



"message": "Syntax error "Field reactions specified more than once. This is only possible before version 2.1" 


From here it is quite clear to me that FB does not allow specifying a field more than once but just doing reactions.limit(0).summary(1) just returns the total reactions, how am I able to retrieve the reactions from each post without having to bust the API. It gets more confusing as the APIs constantly change throughout time and now we have v3.2 and most of the methods I have researched on SO does not apply anymore.










share|improve this question















I managed to return the first page of my posts with some details including its ID with:



api = 'https://graph.facebook.com/v3.2/me'
key = 'secret'

payload = {'fields':'''
posts{permalink_url,created_time,admin_creator,message}'''
, 'access_token':key}

r = requests.get(api, params = payload)


In the FB Graph API documentation, you can do an API call like this /{object-id}/reactions, so now with the ID, getting the reactions is possible. But I need to get the reaction counts by type, so after some research, I find out that I will be able to chain the calls like below.



reactions.type(LIKE).limit(0).summary(1).as(LIKE),
reactions.type(LOVE).limit(0).summary(1).as(LOVE),
reactions.type(WOW).limit(0).summary(1).as(WOW),
reactions.type(HAHA).limit(0).summary(1).as(HAHA),
reactions.type(SAD).limit(0).summary(1).as(SAD),
reactions.type(ANGRY).limit(0).summary(1).as(ANGRY),
reactions.type(THANKFUL).limit(0).summary(1).as(THANKFUL)


Fine now everything is working, but after a pause, I realized that no way in FB will allow me to run those calls for each post especially after I get all the posts IDs since the beginning and sure enough it does not.



So there's this thing about batching as well where I tried to do, where I stacked multiple IDs;



fields=id,reactions.type(PRIDE).limit(0).summary(1),reactions.type(LIKE).limit(0).summary(1)&ids=id1,id2


but I get this instead;



"message": "Syntax error "Field reactions specified more than once. This is only possible before version 2.1" 


From here it is quite clear to me that FB does not allow specifying a field more than once but just doing reactions.limit(0).summary(1) just returns the total reactions, how am I able to retrieve the reactions from each post without having to bust the API. It gets more confusing as the APIs constantly change throughout time and now we have v3.2 and most of the methods I have researched on SO does not apply anymore.







facebook facebook-graph-api python-requests facebook-javascript-sdk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 20:18

























asked Nov 19 at 20:12









BernardL

2,3331829




2,3331829












  • Where did the .as(…) go?
    – misorude
    Nov 20 at 7:59










  • It seems the later APIs do not support aliases for certain endpoints so I removed them.
    – BernardL
    Nov 20 at 8:06










  • Works fine when I test it against v3.2
    – misorude
    Nov 20 at 8:13










  • Even for batching?
    – BernardL
    Nov 20 at 22:14










  • If by that you mean the ids=id1,id2 syntax (which isn’t really making batch requests), then Yes.
    – misorude
    Nov 22 at 7:21


















  • Where did the .as(…) go?
    – misorude
    Nov 20 at 7:59










  • It seems the later APIs do not support aliases for certain endpoints so I removed them.
    – BernardL
    Nov 20 at 8:06










  • Works fine when I test it against v3.2
    – misorude
    Nov 20 at 8:13










  • Even for batching?
    – BernardL
    Nov 20 at 22:14










  • If by that you mean the ids=id1,id2 syntax (which isn’t really making batch requests), then Yes.
    – misorude
    Nov 22 at 7:21
















Where did the .as(…) go?
– misorude
Nov 20 at 7:59




Where did the .as(…) go?
– misorude
Nov 20 at 7:59












It seems the later APIs do not support aliases for certain endpoints so I removed them.
– BernardL
Nov 20 at 8:06




It seems the later APIs do not support aliases for certain endpoints so I removed them.
– BernardL
Nov 20 at 8:06












Works fine when I test it against v3.2
– misorude
Nov 20 at 8:13




Works fine when I test it against v3.2
– misorude
Nov 20 at 8:13












Even for batching?
– BernardL
Nov 20 at 22:14




Even for batching?
– BernardL
Nov 20 at 22:14












If by that you mean the ids=id1,id2 syntax (which isn’t really making batch requests), then Yes.
– misorude
Nov 22 at 7:21




If by that you mean the ids=id1,id2 syntax (which isn’t really making batch requests), then Yes.
– misorude
Nov 22 at 7:21

















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',
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%2f53381960%2fretrieving-batch-fb-reactions-from-multiple-posts%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53381960%2fretrieving-batch-fb-reactions-from-multiple-posts%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







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin