I was trying to get the photos from facebook using the graph api, however, it seems like it will not include theose multi-photo upload images.
I have use graph api explorer to check, I put down
/<album id>/photos
It seems only retrieve the single photos and does not show the multi-photo upload images in the list.
How do I retrieve those multi-photo upload images using graph api?
From my understanding of the Graph which I won't deny is a bit limited compared to most. FB Graph api is a one to one upload. In order to upload multiple files you have to come up with a logic that suits your apps needs. Essentially building your own "queue" like logic so one photo will send after the other after the other.
Session.openActiveSession() only get the basic permissions such as "user_about_me", "basic_info" and "user_photos". To prove this, you could get the permissions from access token via Session.getActiveSession().getPermissions().
Thus, if you want to show multi-photo upload, you need to request additional permission "user_status". Below is the sample code, it works for me.
Session.openActiveSession(this, true, new Session.StatusCallback() {
//callback when session changes state
#Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
List<String> PERMISSIONS = Arrays.asList("user_photos","user_status");
session.requestNewReadPermissions(new Session.NewPermissionsRequest(PictureStreamMainActivity.this, PERMISSIONS));
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
// callback after Graph API response with user object
#Override
public void onCompleted(GraphUser user, Response response) {
// TODO Auto-generated method stub
mMeId = user.getId();
}
});
}
}
});
Related
We've been using the google people api to list internal contacts in a custom staff directory on our company's intranet. We've been using the people api so that we can retrieve profile pictures as well as standard profile fields, as the pictures are blocked when using the google Admin SDK. However we've noticed recently that certain contacts are missing from the people API (e.g. new starters).
I've tried using the Admin SDK users.list method to return the users, and can see that the new users definitely exist in the directory, but using the people.listDirectoryPeople method the same users aren't being returned. Is there a way to sync up the directory people contacts list and the admin directory users list? Or is there something I'm missing in my request that's causing me to retrieve old data?
This is a code snippet to show the parameters I'm using with the API (further down there's more code which gets the other pages of results):
authenticate().then((res) => {
let token = res as JWT;
const service = google.people({ version: 'v1', auth: token });
let params: people_v1.Params$Resource$People$Listdirectorypeople = {
readMask: 'addresses,photos,emailAddresses,locations,names,organizations,phoneNumbers,relations',
pageSize: 500,
sources: ['DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE'],
};
service.people.listDirectoryPeople(params, async (err, res) => {
I have a page that acts as the admin of various events. I am attempting to retrieve a list of people who have RSVPed as attending.
I used to be able to access this list with the following, where the access token was generated by an app I created:
FB.api(
'/{event-id}/attending',
'GET',
{'access_token':{access-token}},
function(response) {
// Insert your code here
}
);
This now results in a permission error.
I've used the explorer to try generating different types of access tokens, but all I can get from that edge now is an empty data object.
I've read that permissions errors will fail silently in this manner, but I can't figure out what permissions I need to retrieve this data. Even when I use an access token from the page (which is listed as an event admin), I come up with nothing.
It is no longer possible to get the attendees:
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#events-4-4
GET /events — You can no longer get the following edges:
attending
comments
declined
feed
interested
live_videos
maybe
noreply
photos
pictures
posts
videos
I am working with facebook graph api rsvp_event. I am using javascript SDK. Everything works great when the user is logged in. But when the user is not logged in, it gives an error.
I need information about who is attending a public event. I now understand that I would need an access token to retrieve this information. So, my question is how do I get the access token if no user is logged in? Is it impossible or is there a workaround? Could it be done server side using app_id and client_secret?
I am developing a ColdFusion page, but I can use PHP if needed. I have support for both.
I have heard the term *offline_access_permission*. They have removed this feature. Could it be done when it was still available?
EDIT:
Could this be achieved by test user? Say, on server side I login via test user, get the event information (Just a "get" request to read who is attending an event) and then log off. On the client side I do the rest ( user login, rsvp to an event).
I don't know much about "test user" or its purpose. Can anyone confirm whether this can be achieved or not?
Thanks in advance.
Are you sure you actually need the user's access token? According to documentation here you may need:
- a generic access_token for public events (those whose privacy is set to OPEN)
- a user access_token for a user who can see the event for non-public events
- an app access_token (for non-public events, must be the app that created the event)
- a page access_token (for non-public events, must be the page that created the event)
You can get info on how to get those tokens here https://developers.facebook.com/docs/concepts/login/access-tokens-and-types/
A good idea could be to store the attending users (in the DB) when you have access to the event - when some user is logged in.
UPDATE for getting the data from FileContent.
I don't know what API response exactly you are referring to, but from my experience they are returning data:
- serialized using JSON - you need to use DeserializeJSON(), for example like this:
local.returnStruct = DeserializeJSON( local.requestResult.FileContent );
or
local.returnStruct = DeserializeJSON( local.requestResult.FileContent.toString() );
send as something similar to URI. I'm using a function to get that data:
function getStructFromQueryString( queryString ) {
var ret = StructNew();
var i = 0;
var key = '';
for(i=1; i LTE ListLen(arguments.queryString,'&'); i++) {
key = ListGetAt(arguments.queryString, i, '&');
ret[ListFirst(key,'=')] = URLDecode(ListLast(key,"="));
}
return ret;
}
Basically what you want is a refresh token that can get access tokens when the user is offline, unfortunately facebook does not provide them anymore as far as i know.
To learn more about oauth2 pleas play around with https://developers.google.com/oauthplayground/ its a very nice tool to understand the oauth2 process.
I want my Silverlight app to let the user delete a photo from his Facebook account, photo that I have already successfully retrieved from there and shown to the user, but the photo I want to delete is never deleted. Delete operation is supposed to be supported by the Facebook API (http://developers.facebook.com/docs/reference/api/), and I tried these two ways:
FacebookClient fb = new FacebookClient(_accessToken);
var parameters = new Dictionary<string, object>
{
{"method", "delete"}
};
fb.PostAsync(id, parameters);
This one returns an exception message from Facebook API ("Unknown method"), and then I tried this other way:
FacebookClient fb = new FacebookClient(_accessToken);
fb.DeleteAsync(id);
being "id" the id of the photo I want to delete in both cases. This way I get a positive response but the photo is simply not deleted, what is wrong? Do I need an extra permission for deleting? I didn't found anything related to that in the Facebook documentation, I assumed that it was enough being able to grant permissions to access the photos, thing that I already do... I need some help.
You can't delete photos using the API ; you can check the Photo API doc at http://developers.facebook.com/docs/reference/api/photo/ and a long-running forum thread at http://forum.developers.facebook.net/viewtopic.php?id=96837
Coding in ASP.NET 4.0 / javascript/ jQuery/ WebServices
The Scenario
I have an analytics account i have set up at, say, some-name#gmail.com with password as pass123
I also know the table id,say ga:30037474
My question is can I pull data like
// Load the Google data JavaScript client library.
google.load('gdata', '2.x', { packages: ['analytics'] });
// Set the callback function when the library is ready.
google.setOnLoadCallback(init);
function init() {
myService = new google.gdata.analytics.AnalyticsService('charts_sample');
//how do i securely pull data without exposing my credentials if client login is a must
getDataFeed();
}
/**
* Main method to get report data from the Export API.
*/
function getDataFeed() {
myService = new google.gdata.analytics.AnalyticsService('charts_sample');
var myFeedUri = ['https://www.google.com/analytics/feeds/data',
'?start-date=2010-06-01',
'&end-date=2010-06-10',
'&dimensions=ga:day,ga:visitorType',
'&metrics=ga:visits',
'&sort=ga:day',
'&max-results=20',
'&ids=',
'ga:30037474'].join('');
myService.getDataFeed(myFeedUri, handleDataFeed, handleError);
}
Or shall i authenticate the client before this?
If I need to authenticate the client, it would be better if I get some pointers on how to proceed with these two requirements.
1. Cannot authenticate by exposing the user credentials on client side(Need a webservice like thing)
2. When my site loads, it should load up with the analytics data(should not ask for login then and there to pull the analytics data).
Are there any articles anywhere?
Not sure if this answers your question. Based on the content of your question it seems you have a very good handle on the Google Analytics API. But somewhere along the line someone will need to grant access to the Google Analytics data. Using AuthSub this can be accomplished. Basically the user will need to do a one-time login to Google Analytics and "grant" your webservice a long-lived token to access their data. Once this is done you can store this token and associate it with their account, passing it when making data calls to the Google Analytics API.