Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support POST methods on any api call, allow overriding access tokens, support for app sessions #15

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

tarqd
Copy link

@tarqd tarqd commented Nov 8, 2012

Basically I've renamed post() to postFeed to make room for a method that allows you to POST to any graph api.

Example (uploading a picture from a url)

req.facebook.post('/me/photos', { name: 'Cool picture', url: 'http://example.com/example.png' } ,function(err, result){
     console.log('result from api : ', err, result);
});

App session support works as follows (sending a notification requires an app access token not a user access token)

  req.facebook.appSession(function(err, session){
    session.post('/1234/notifications', {href: '', template: 'Notification from app!'}, function(err, result){
      res.send("Sent notification to uid 1234!");
    });
  });

I also made it so when there's an API error it wraps up in an error object (FacebookApiError) which inherits from Error

// assume an error occurs
req.facebook.get('/me/friends', function(err, friends){
     if(err){
        console.log(err.message);
        console.log(err.type);
        console.log(err.code);
     }
});

@tarqd
Copy link
Author

tarqd commented Dec 26, 2012

Any word on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant