I can get the picture with this code:
https://graph.facebook.com/userid/picture
but this doesn't work:
https://graph.facebook.com/userid/first_name
How can I get user's name ?
Phone Number Verification Code To get a phone number's ID, call to https://graph.facebook.com/ v14. 0 /{whatsapp-business-account-ID}/phone_numbers . Replace {whatsapp-business-account-ID} with the ID of the WhatsApp Business Account the phone number belongs to. See Get all phone numbers for an example.
The simplest way to get a copy of the User Profile object is to access the /me endpoint: FB. api('/me', function(response) { }); This will this will return the users name and an ID by default.
You can access Graph Explorer at: https://developer.microsoft.com/graph/graph-explorer. You can either access demo data without signing in, or you can sign in to a tenant of your own. Use the following steps to build the request: Select the HTTP method.
You cannot get first_name
like you are getting picture.
https://graph.facebook.com/userid/?fields=first_name
will get
{
"first_name": "Jashwant",
"id": "1137725463"
}
Then you can get first_name
by any json parser.
Here's the GIVE_ME_THE_CODE version,
<html>
<head>
<style>
</style>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$.getJSON('http://graph.facebook.com/jashwantsingh?fields=first_name',function(data){
$('<p>' + data.first_name + '<p>').appendTo('body');
})
})
</script>
</head>
<body>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With