Calling the Facebook campaign insights API, I want to retrieve "action_values".
I've tried from PHP code and from tool explorer using an url like this:
XXXXXX/insights?fields=action_values
but this is the result (action_Values not appear in response)
{
"data": [
{
"date_start": "2021-02-25",
"date_stop": "2021-02-26"
}
],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MAZDZD"
}
}
}
Related
I'm requesting child pages from a specific Page and I'm explicity requesting the access_token on fields but the response doesn't include the requested attribute.
Can someone help me understanding what's going on?
First of all I request the pages from an account through /v15.0/me/accounts endpoint:
https://graph.facebook.com/v15.0/me/accounts?access_token=[FILTERED]&fields=id,name,has_transitioned_to_new_page_experience,access_token
And here's the output:
{
"data": [
{
"access_token": [FILTERED],
"id": "10[...]80",
"name": "Lorem Ipsum",
"has_transitioned_to_new_page_experience": true
}
],
"paging": {
"cursors": {
"before": [FILTERED],
"after": [FILTERED]
}
}
}
Using that same id I then try to get all the child pages from that Page using /v15.0/OBJECT-ID/locations:
https://graph.facebook.com/v15.0/10[...]80/locations?access_token=[FILTERED]]&fields=id,name,access_token
{
"data": [
{
"id": "16[...]55",
"name": "Lorem Ipsum"
},
{
"id": "10[...]68",
"name": "Lorem Ipsum"
}
],
"paging": {
"cursors": {
"before": [FILTERED],
"after": [FILTERED]
},
"next": "https:\/\/graph.facebook.com\/v15.0\/10[...]80\/locations?access_token=[FILTERED]&fields=id%2Cname%2Caccess_token&limit=25&after=[FILTERED]"
}
}
But even asking for the access_token the attribute is not returned.
Some considerations:
Permissions that I'm requesting during the authentication:
"email,pages_manage_metadata,pages_read_engagement,pages_read_user_content,pages_manage_engagement,pages_messaging,pages_messaging_subscriptions"
And the account has "MODERATE" role.
Am I missing something?
Requested the API as the docs show.
Expected to get the access_token attribute.
I am using the Facebook API to retrieve comments from my posts.
Most of the time, when there are more than 25 comments on a post, I am given this paging information:
{
//COMMENT DATA
"paging": {
"cursors": {
"before": "",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
},
"next": "https://graph.facebook.com/v12.0/165099760197787_7215028868538139/comments?access_token=ACCESS_TOKEN&pretty=1&limit=25&after=WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
}
}
Or, if there isn't another page, I get this (no "next" value):
{
//COMMENT DATA
"paging": {
"cursors": {
"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4TlRNNU56QTJOVEUyTnprNE5qb3hOalE0TmpReE16WXkZD",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
}
}
}
Everything works well with the above. But sometimes, I get paging information that doesn't have ANY paging cursors despite definitely having more than 25 comments. How am I supposed to page through the data with this? Any idea why it is giving me incomplete paging data? It looks like this:
{
//COMMENT DATA
"paging": {
"next": "https://graph.facebook.com/v12.0/165099760197787_1346071832565247/comments?access_token=ACESS_TOKEN&pretty=1&limit=25&after"
}
}
I currently don't have any campaigns that have been launched with ACTIVE status in Facebook so whenever I try to query the insights endpoint I receive an empty array of data[] which doesn't allow me to do much.
I would like to know how a response would look for an adset that has been launched with an active status and actually contains insights' data, using a query like this one:
GET graph.facebook.com/v8.0/{adset_id}/insights?date_preset=lifetime&fields=reach,unique_ctr,cpm&access_token={access_token}
I think is that it might look something like this, but I would like to get the exact response structure:
{
"data": [
{
"name": "metric_name",
"values": [
{
"end_time": "some_date_string",
"value": numeric_string,
}
]
}
]
}
I've made <adset_id>/insights?date_preset=lifetime&fields=reach,unique_ctr,cpm
Example output:
{
"data": [
{
"reach": "12739",
"unique_ctr": "1.420834",
"cpm": "13.740269",
"date_start": "2020-02-25",
"date_stop": "2021-01-28"
}
],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MAZDZD"
}
}
}
I'm playing with facebook explorer to get event photos urls.
For {event-id}/photos I get something like:
{
"data": [
{
"created_time": "2015-12-07T20:53:44+0000",
"name": "1913 rok.",
"id": "178797088851556"
}
],
"paging": {
"cursors": {
"before": "OTc4Nzk3MDg4ODUxNTU2",
"after": "OTc4Nzk3MDg4ODUxNTU2"
}
}
}
How can I exctract this photo (id: 178797088851556) url?
It´s called "Declarative Fields":
/{event-id}/photos?fields=name,source
Check out the API reference for all available fields.
I have post_id of the status which user share by iOS app, Now with graph api, I'm getting comment info and like info:
POST_ID?fields=likes.fields(pic_square,name),comments
With above, I'm able to fetch most of the details, but not profile pic of user who commented on post. check details which I'm getting:-
{
"id": "POST_ID",
"updated_time": "2014-03-25T07:07:14+0000",
"likes": {
"data": [
{
"pic_square": "https://fbcdn-profile-a.akamaihd.net/static- ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif",
"name": "User name",
"id": "100007640XXXXX"
}
],
"paging": {
"cursors": {
"after": "MTAwMDA3NjQwMzcxMzQxxx",
"before": "MTAwMDA3NjQwMzcxMzQxxx"
}
}
},
"comments": {
"data": [
{
"id": "2069772628xxxxxx",
"from": {
"name": "user name",
"id": "100007640xxxxxx"
},
"message": "great reader..",
"can_remove": true,
"created_time": "2014-03-26T06:19:36+0000",
"like_count": 0,
"user_likes": false
}
],
"paging": {
"cursors": {
"after": "MQ==",
"before": "MQ=="
}
}
}
}
Now I need picture of a user who commented on post, I'm getting picture of user who likes, but not who commented. I tried to get it with FQL but not succeed.
Here in response you are getting user id who had liked your post so use that as follows
https://graph.facebook.com/10000445993xxxxx/picture?type=large
Use this API:
https://graph.facebook.com/100007640xxxxxx/picture
100007640xxxxxx: is userid.
Edit:
if you want to load user picture in particular size then you can use following:
https://graph.facebook.com/100007640xxxxxx/picture?width=150&height=150