Facebook graph api returns no email - facebook

I'm calling
https://graph.facebook.com/<user_id>/?access_token=<valid_token>
or just
https://graph.facebook.com/me/?access_token=<valid_token>
and getting back json object that doesn't contain primary user email which I need.
I setup email permission for the app and no effect.
What can be wrong?

Did you remember to ask for the email permission in the login request? You do this by adding the scope parameter like this in the login request (&scope=email):
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_REDIRECT_URI&state=SOME_ARBITRARY_BUT_UNIQUE_STRING&scope=email
Facebook API reference

You probably do not have email permissions in your access token.
You can verify it with the Acess Token Debugger

I believe that your question is, even after granting permission to access email, you are not able to get email information through the Graph API. In newer versions, you need to pass fields param to the API to get additional information such as email. By default, it only provides id and name in response. Please find a sample below on how to get other info from graph :
https://graph.facebook.com/me?fields=id,email,first_name,gender,last_name,link,locale,name,timezone,updated_time,verified&access_token=<value of access_token>&debug=all
Hope this helps.

It is possible that the email is not verified in facebook. In this case facebook doesn't make it available via the API. Make sure your code handles this case.

Since the release of API version 2.5 you can get user email like this: https://graph.facebook.com/v2.5/me?fields=id,name,email

Related

How to get the Calendly user and organization details which require to call the API

I have created a account with Calendly and want to consume the API's. Here is the link for API's
I have created a token using "Personal Access Token" mechanism provided by Calendly.
If we refer the document, it require some parameter pass to the API like organization, user etc.
I have gone through all the account which I created in Calendly but not able to found these details. Here is the reference where I am expecting it.
Anyone has any idea how can I get this info in Calendly so I can able to call these API's.
Thanks,
Atul
Found the way to get the info.
If you have valid account and valid "Personal Access Token" then you can get the info by calling this API of Calendly.
Refer the screeshot:
This is how you get the details for the user and organization. Then this info you can use to call the API's.
Thanks,
Atul

Facebook API - How do I create an ad account?

I am currently trying to create an ad account using fb's api. After checking out their documentation I ended up with this source. Here it states that we can make a call to
/{business_id}/adaccount given the appropriate body to create an ad account, and therefore I went to give it a try.
On my test, I tried sending a POST request to that endpoint:
POST {FB_API_PATH}/{business_id}/adaccount?access_token={FB_ACCESS_TOKEN}
BODY
{
"name": "Test",
"currency": "USD",
"timezone_id": 1,
"end_advertiser": "{FB_APP_ID}",
"media_agency": "{FB_AGENCY_ID}",
"partner": "NONE",
"funding_id": "{FB_FUNDING_ID}"
}
but ended up getting:
Unsupported post request. Object with ID '{business_id}' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api.
This is not because I'm using an incorrect {business_id}, all of my other test calls that are using the same {business_id} are working perfectly.
It seems to me that for some reason, I cannot make a call to /adaccount. I went to check the facebook graph explorer and wasn't able to get the autocomplete trigger for that endpoint when inputing the {business_id}.
Am I doing something wrong, or was this endpoint never working and I need to keep doing it manually?
You need to have Advanced Access to business_management permission.
You can submit app review for advanced access, if it approved, you can call /bm-id/adaccount to create ad account with required parameter.
Also, you can't create an ad account on a real FB user. It works with test users well, but you need special permissions from FB to do this on a real user's account.

Facebook API Lead Ad webhook lead retrieval

I have setup a webhook for Facebook Lead Ads
It is receiving data like this:
{"object":"page","entry":[{"id":"718196074978224","time":1453818316,"changes":[{"field":"leadgen","value":{"ad_id":"399579767903","adgroup_id":"971076277715","created_time":1453789516,"form_id":"930912320812","leadgen_id":"151977133461","page_id":"718196074978224"}}]}]}
The next step is to retrieve the details.
The docs say
https://graph.facebook.com/v2.5/
but if I use the leadgen_id (151977133461) this returns
"singular published story API is deprecated for versions v2.4 and higher"
I've also read that _ might work, but that returns a different error.
Answered my own question: subscribed_apps wasn't set up correctly
You just need page access token to retrive the values from the lead. You need to make a GET call on
https://graph.facebook.com/v2.11/<leadgen_id>?access_token=<page_access_token>
For more info go through this link it will help you: http://tanmayverma.com/reactjs/storing-facebook-lead-data-in-our-database-in-real-time-using-reactjs-meteorjs-and-fbs-javascript-sdk/

How to retrieve multiple user account details through their Facebook IDs in graph API?

This could be a duplicate of here and here, but can some one provide a complete working example for following.
I have set of different Facebook account Ids, and i need to get the respective account details(user name etc) from these account ids. I need to send a Batch Request for Graph API. Something as follows,
(https://graph.facebook.com?ids=user1, user2, user3,...)
Is this possible as pure HTTP GET request ?
I am using Facebook SDK with Android for the moment. I have gone through the API doc but unable to build the required query yet. Please help.
Maybe post a snippet of your code so we can try to solve your problem better. With the info you provided, the URL https://graph.facebook.com/?ids=user1,user2,user3 works just fine and returns 3 users.
The URL format looks correct. Keep in mind the total character limit, but otherwise I suspect you are stuck in a different place (e.g. sending the query or saving the result).

Bigcommerce API Authenticating a customer with GET request

I'm doing a GET for customers with a given email address (there will only be one). Before displaying the returned information, I need to authenticate the user, but I can't see a way in the docs that allows providing a password as a parameter to a GET. In fact It only seems to be possible to provide a password when creating (POSTing) or updating (PUTting) a customer. Is it possible to authenticate customers via the API this way?
from what I understand - _authentication is only supported for POST and PUT on customer objects. I believe it is intended to create a customer who can login and stuff like that.
Can you explain your use case and maybe there is a workaround..