Instagram Insights: gap between app and API - facebook-graph-api

I would retrievied Reach insight from an Instagram account through the Graph API
Here the Reach value given by Instagram application from the October 14th to October 15th
I'm requesting the Graph API with this request:
https://graph.facebook.com/v13.0/{{IN_PAGE_ID}}/insights?metric=reach&period=day&since=1665705600&until=1665878399
The response:
{
"data": [
{
"name": "reach",
"period": "day",
"values": [
{
"value": 73355,
"end_time": "2022-10-14T07:00:00+0000"
},
{
"value": 89052,
"end_time": "2022-10-15T07:00:00+0000"
}
]
}
]
}
For this given API response, I compute a 162.407 Reach value for the given range
How to explain the gap between API data and app data ?

Related

How can I get engagement data over time for an Instagram business account user and media post (IG Graph API)?

I would like to know if there is a way to get engagement for a month (ex. get total engagement from current date minus 30 days) for an Instagram post in the
Instagram Media Insights API or total engagement from a month from Instagram User Insights API.
As of now from the IG Media Insights, it seems you can only get cumulative engagement (see snippet below taken from IG Media Insights API:
{
"data": [
{
"name": "impressions",
"period": "lifetime",
"values": [
{
"value": 264
}
],
"title": "Impressions",
"description": "Total number of times the media object has been seen",
"id": "17855590849148465/insights/impressions/lifetime"
},
{
"name": "reach",
"period": "lifetime",
"values": [
{
"value": 103
}
],
"title": "Reach",
"description": "Total number of unique accounts that have seen the media object",
"id": "17855590849148465/insights/reach/lifetime"
}
]
}
Thank you for your time :-)
For IG Media Insights you can only see lifetime metrics. If you wanted a monthly breakdown you would have to build a mechanism to query the lifetimes every month and calculate the delta to track monthly change.
For IG Account Insights you can use metrics which offer days_28 period or use the since and until filtering.

Provide metrics for Business Discovery insights in Instagram Graph API

I was creating an application to get insights into business and creator accounts. But when I was trying out to get insights of an account using business discovery, I was receiving the error
{
"error": {
"message": "(#100) For field 'insights': The parameter metric is required",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "A_VNXOMovZwvUpzUFVF5y87"
}
}
The query I fetched was ?fields=business_discovery.username(google){insights{impressions}}
I know how can I fetch insights data for my account /insights?metric=impressions&period=day. But I cannot understand, how can I give the period argument in that previous query?
Business discovery cannot get insight data.
You should use insight api instead.
Here's a simple account insight fyr
17841403823915540/insights/?metric=follower_count,reach,impressions&period=day&since2021-01-11&until=2021-01-18
And you will get sth like:
{
"data": [
{
"name": "follower_count",
"period": "day",
"values": [
{
"value": 0,
"end_time": "2021-01-16T08:00:00+0000"
},

Youtube API error "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup" from Google Cloud Platform VM

I've added an API Key for my project and I'm trying to retrieve data via URL:
https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2Cstatistics&id={VIDEO_ID}&key={MY_KEY}
When I try it in my browser, I get the response:
{
"kind": "youtube#videoListResponse",
"etag": "\"{ETAG}\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"{ETAG}\"",
"id": "{VIDEO_ID}",
"contentDetails": {
"duration": "PT3M11S",
"dimension": "2d",
"definition": "sd",
"caption": "false",
"licensedContent": false,
"projection": "rectangular"
},
"statistics": {
"viewCount": "12822",
"likeCount": "44",
"dislikeCount": "0",
"favoriteCount": "0",
"commentCount": "4"
}
}
]
}
But it doesn't work from my Google Cloud Virtual Machine, I get an error:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
This API key is unrestricted.
What is wrong? How to fix it?

How can we get the phone number with Google OAuth API and facebook API used for social login?

How can we get the phone number with Google OAuth API login.
I am using scopes as
'scope' : 'https://mail.google.com https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.login '
and the request is as
var request = gapi.client.plus.people.get({'userId': 'me'});
Is there any scope we can use to get it.
I am getting response as with no sight of phone number :
{
"kind": "plus#person",
"etag": "\"vPymIyv1bT9LfmoUujkgN2yLMK0\"",
"gender": "male",
"emails": [
{
"value": "XXX#gmail.com",
"type": "account"
}
],
"urls": [
{
"value": "http://picasaweb.google.com/XXX",
"type": "otherProfile",
"label": "Picasa Web Albums"
}
],
"objectType": "person",
"id": "4354354334435465",
"displayName": "XXXXX YYYY",
"name": {
"familyName": "XXX",
"givenName": "YYYYY"
},
"url": "https://plus.google.com/1100335464643327",
"image": {
"url": "https://lh3.googleusercontent.com/-fgsdgfgU9-jU/AAAAAAAAAAI/AAAAAAAADkM/fgffdgdkM/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"language": "en",
"ageRange": {
"min": 21
},
"circledByCount": 59,
"verified": false
}
if you want to get user phone numbers you have to have authorization from the user: see the following info page : https://developers.google.com/admin-sdk/directory/v1/guides/authorizing
ask the user for this scope of authorization :
https://www.googleapis.com/auth/admin.directory.user.readonly
after you have authorization from user run the folowing request :
GET https://www.googleapis.com/admin/directory/v1/users/userKey
the response will be a JSON response formatted as followed:
https://developers.google.com/admin-sdk/directory/v1/reference/users#resource
one of the attributes is phone list.
hope it helps.
You can use google's people API to get the user's phone numbers.
To explore more you can try yourself.
Steps to explore:
Visit this link.
Select https://www.googleapis.com/auth/user.phonenumbers.read permission in People API v1 section
Click on Authorize API
Choose the account to log in
Grant permission
Click Exchange authorization code for tokens
Enter https://people.googleapis.com/v1/people/138262720636785143353?personFields=phoneNumbers,emailAddresses link, make sure you replace the UID
Click on send request to see the response

Facebook graph API obtain a specific users's pictures from that same user

I'm working on an Android application and I'm trying to obtain contact pictures from friends. I'm still testing the graph request on the Facebook Graph API Explorer linkhere I'm going to use afterwards in the code, and I've hit a snag...
After generating an Access Token, and validating it allows me access to the correct fields I'm interested, I'm trying to filter the information I'm obtaining from Facebook.
Using the Facebook Graph API Explorer I'm performing the following request:
< USER_ID>?fields=id,first_name,last_name,location,picture,birthday,photos.limit(3).fields(id,picture,source,from)
I obtain, as expected:
{
"id": "<USER_ID>",
"first_name": "<FIRST>",
"last_name": "<LAST>",
"photos": {
"data": [
{
"id": "<PICTURE1>",
"source": "<PIC1.jpg>",
"from": {
"name": "<OTHER_USER1>",
"id": "<OTHER_USER1_ID>"
},
"created_time": "2013-08-17T11:39:19+0000"
},
{
"id": "<PICTURE2>",
"source": "<PIC2.jpg>",
"from": {
"name": "<OTHER_USER2>",
"id": "<OTHER_USER2_ID>"
},
"created_time": "2013-08-04T14:27:07+0000"
},
{
**"id": "<PICTURE3>"**,
"source": "<PIC3.jpg>",
"from": {
"name": "<USER>",
**"id": "<USER_ID>"**
},
"created_time": "2013-08-03T17:35:20+0000"
}
],
"paging": {
"previous": "<LINK1>",
"next": "<LINK2>"
}
},
"picture": {
"data": {
"url": "<PIC>",
"is_silhouette": false
}
}
}
What I would like is to only obtain the pictures from ... like the third picture or others, is this possible using the graph api?
Thanks for the help.
Marc
PS:
I've tried adding in the end something like &photos.data.from.id=< USER_ID>
but I till get the same data set in response.
I would like to avoid requesting more pictures and filter it programmatically, because You never know how many pictures are associated with a user that where not submitted by that user.
Not possible with the Graph API, but you can use FQL, to query for the photos of the user (not those in which he's tagged in) -
SELECT pid,src FROM photo WHERE owner = me()
Check FQL - Photo to include the required fields in the result.