I have asked some old questions previously but those were quite misleading. So I decided to delete them and creating this one.
My object has a custom property named say it is portal content. In the Facebook Graph API Explorer data related to this object shown like;
{
"created_time": "2015-11-26T08:42:26+0000",
"title": "Title",
"type": "ns:type",
"data": {
"portalcontent": "portalcontent"
},
"id": "12515125125"
},
{
"created_time": "2015-11-26T08:04:09+0000",
"title": "Title2",
"type": "ns:type",
"id": "412512512512"
},
{
"created_time": "2015-11-25T12:56:03+0000",
"title": "Title3",
"type": "ns:type",
"id": "234124124124"
}
I am trying to query this data using Facebook graph api. But can not fetch just based on the portal content custom property.
So far I tried;
appid/objects?pretty=0&type=ns:type&limit=100&portalcontent=portalcontent
to do so. But it is still fetching all objects.
PS: please pm or comment on question for why you are downvoting it. Provide what else you need that I must put on the question. Downvoting for no reason getting people annoyed.
There's currently no way to filter results other than those described on the respective endpoint's docs.
See
https://developers.facebook.com/docs/graph-api/reference/application/objects/
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5
I want to retrieve the logged in user country, and insert it into a div.
I succeed making it with the user Name, Gender and Age range, but somewhy I can't retrieve the country.
Here is my code:
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me?fields=name,email,gender,age_range,picture,country', function (response) {
document.getElementById('status').innerHTML = response.name + ",";
document.getElementById('status1').innerHTML = response.gender + ",";
document.getElementById('status2').innerHTML = (response.age_range.min) + "-" + (response.age_range.min + 1) + " years old";
document.getElementById('status3').innerHTML = response.country;
}
Thanks!
To complete what Lix said:
You can do it with only one call to Graph API, by calling
/me?fields=name,email,gender,age_range,picture,location{location}
Indeed, the location object under the user object is a Page object, which has a Location object.
So, this will give you something like this:
"location": {
"location": {
"city": "Ramat Gan",
"country": "Israel",
"latitude": 32.0833,
"longitude": 34.8167,
"zip": "<<not-applicable>>"
}
}
This avoids you to make a double call to Graph API.
I believe the parameter you are looking for is location instead of country.
/me?fields=name,email,gender,age_range,picture,location
In order to query this data, you'll need your users to grant you the user_location permission.
This will give you value of the user submitted field - take note that this parameter might not always be populated since it depends on the user actually submitting this information - if they have not provided it - you will not be able to retrieve it.
The object will look something like this:
"location": {
"id": "112604772085346",
"name": "Ramat Gan"
},
Once you have the location object (which will most likely be a page), you can query that object to retrieve the country:
/112604772085346?fields=location
This will give you more information including the country.
{
"location": {
"city": "Ramat Gan",
"country": "Israel",
"latitude": 32.0833,
"longitude": 34.8167,
"zip": "<<not-applicable>>"
},
"id": "112604772085346"
}
Fields in Fb API are now concatenable, so, for a detailed info of User's location you need:
scope="public_profile,user_location"
fields="name,location{location{country, country_code, city, city_id, latitude, longitude, region, region_id, state, street, name}}"
v2.11 query:
/me?fields=hometown,location
permission:
user_hometown
user_location
result:
{
"hometown": {
"id": "XXXXREDACTED",
"name": "Manila, Philippines"
},
"location": {
"id": "XXXXREDACTED",
"name": "Manila, Philippines"
},
"id": "XXXXREDACTED"
}
I am interested in retrieving a Facebook group members' Bio information.
I have created an app where I have requested permission of about user_about_me and the app is under review for submission.
I have coded for the app in JSP but it can only select name, gender, last_name, first_name only. It is not selecting the Bio information.
I face the same problem even in the graph API explorer, when I use
{group_ID}/members
I can retrieve list of all group members. But I can not see more details than the following:
"data": [
{
"name": "name",
"administrator": false,
"id": "USER ID"
},
..
When I click on the ID (or enter the ID in the explorer), I can only get the following:
{
"id": "member_ID",
"first_name": "firstname",
"last_name": "lastname",
"link": "https://www.facebook.com/app_scoped_user_id/...",
"name": "name ",
"updated_time": "2015-02-07T10:02:58+0000"
}
This is not showing the Bio information.
when I enter the following:
{member_ID}?fields=bio
I just get
{
"id": "10153223503039309"
}
I will appreciate if someone please identify me the problem. I believe this problem will also solve my code problem, where at the moment I am unable to retrieve the group member's Bio information too.
Is it possible that the problem will be resolved after the app's acceptance, which is under review?
Thanks you very much.
Syed
You canĀ“t just grab more information from the user just because he is a member of some group. You would have to let him authorize your App with the correct permissions in order to get more data.
I work on a web application using AngularJS for the frontend and the backend for Symfony2. I want to make a web service so I can have a one page app. I am wondering about how I should handle the data exchange between the two layers.
Consider this use case:
A user wants to create a project in the application and must specify whether it be as a customer or supplier in that project. The creator of the project gives the project a name and a description. Then he enters the email address of the contact person (who will be the customer or supplier in the project depending on the choice of the user who created the project). When creating the project the system checks whether the contact person is already registered otherwise it sends an invitation to join the application and waits. It is not necessary to invite the contact person at the creation of a project that can be done later.
I imagine the API is as follows:
POST http://app.com/api/projects
Request:
{
"name": "My Project"
"descrption": "My Project'description"
"vendor": {
"user_id": 3245
}
"client": "myclient#email.com"
}
Response:
{
"name": "My Project"
"description": "My Project'description"
"vendor": {
"user_id": 3245,
"name": "John Doe"
}
"client": {
"user_id": 2754,
"name": "Peter Doe"
}
"creator": {
"user_id": 3245,
"name": "John Doe"
}
}
So we can see that the type of data exchanged in the creation of a project differs.
Can I link directly to my model application (after validation of course)?
How should I go about updating a project?
Is it better to create Transfer Objects and managed into my business logic and a TransfertObject for input and one for output?
Is it at all possible to post an action (owned by the app) to an object (NOT owned by the app)? Specifically on Faceook Page and Places, objects owned by FB.
For example I want to create an action called "shop", so that I can create the action
"John drank *Coke*"
in which Coke refers to the FB Page.
I have done a test via the Graph API Explorer and it seems that the app's action POST must refer to an object also owned by the same app. Mind you, I also do not know what shud be syntax to refer to objects owned by FB.
You can tag a place to a post but it will simply prefix it with " -at Walmart"
Yes, this is possible. To set the "at Walmart" part, set the action's "place" field when creating an action via a POST. For example, you can pass this:
?place=https://www.facebook.com/pages/Pizzeria-Delfina/53645450697
which should result in setting the place on an action like:
"place": {
"location": {
"city": "San Francisco, CA",
"zip": "94110",
"country": 398,
"region": 0,
"address": "3611 18th Street/2406 California St.",
"id": 2421836
},
"id": "53645450697",
"name": "Pizzeria Delfina"
},
Documentation on the basic action properties is here:
https://developers.intern.facebook.com/docs/beta/opengraph/actions/#create