This site has been deprecated. Do not edit pages here. Please visit the new Pico Labs documentation.


Skip to end of metadata
Go to start of metadata
Deprecated

This module is no longer supported in the KRL system.

 

The Facebook Library

The Facebook Graph API provides access to Facebook data.  The Facebook KRL library provides simple access to that API. 

Table of Contents

Getting Started

At the Facebook Developer page create an application.  When setting up your application set your Connect URL to http://cs.kobj.net:80/ruleset/fb_callback/.  As part of the OAuth process, KRL tells FB to send a token to a URL on our server (That's how your user can log in and authorize through Facebook and never give out their username and password).  If your Connect URL and the URL that Kynetx provides don't match, the authorization process will FAIL

Create an Application

For KRL, the process of integrating Facebook into your application is the same as the process we use for Twitter and Google.  

First, set up your facebook application information in the meta section:

Next, create a rule to authorize your user with Facebook:

Before any FB request, KRL checks to see if the application has been authorized to access the current user's information.  The auth_app rule explicitly runs that check for you.  IF the user does not have a valid OAuth token,  the OAuth authorization process is started.  The Facebook authorize command takes in  as an argument an array of extended permissions.  They are separated into two major categories: Publishing and Data.  Data is further divided into User and Friends permissions.

Facebook Functions

metadata

The facebook:metadata function takes in a hash of parameters and returns a hash.  For more information please consult the Facebook documentation.

facebook:metadata takes in a hash with the following parameters:

  • optional
  • id : <string>

The following example looks for the metadata of the currently logged in user:

picture

The facebook:picture function takes in a hash of parameters and returns a hash.  For more information please consult the Facebook documentation.

facebook:picture takes in a hash with the following parameters:

  • optional
  • id : <string>
  • square | small | large

Most all objects have a picture or icon associated with them.  When you make a request for the picture.  Facebook returns a redirect to the actual URL.  The facebook library will follow that redirect and return the actual URL for the picture.  This makes a picture call a little bit more complicated so bear that in mind if you are going to do large amounts of picture requests.

The following is an example of facebook:picture:

The facebook:search function takes in a hash of parameters and returns a hash.  For mor information please consult the Facebook documentation

facebook:search takes in a hash with the following parameters:

  • required
  • type : post | user | page | event | group | home
  • q : <string>
  • optional
  • id : <string>

If you find that you aren't getting the results that you think you should, grab the url from the debug and enter it with your browser to see if it's just bad indexing on FB's part.   

get

The facebok:get function takes in a hash of parameters and returns a hash.  For mor information please consult the Facebook documentation

facebook:get takes in a hash with the following parameters:

  • optional
  • connection : <string>
  • type : <facebook object>
  • id : <string>

If you would like to follow a connection: ie. get all the comments associated with a post, just provide a "connection" : <value>.  If you would like KRL to do some sanity checking,  you can use the optional "type" : <object> syntax in conjunction with connection.  KRL will check to see if your connection is valid for that type of object.  If not, a warning will be printed to your console. 

ids

The facebok:ids function takes in a hash of parameters and returns a hash.  For mor information please consult the Facebook documentation

facebok:ids takes in a hash with the following parameters:

  • required
  • ids : <string> | <C>

If you would like to follow a connection: ie. get all the comments associated with a post, just provide a "connection" : <value>.  If you would like KRL to do some sanity checking,  you can use the optional "type" : <object> syntax in conjunction with connection.  KRL will check to see if your connection is valid for that type of object.  If not, a warning will be printed to your console. 

Labels:
  1. Jun 12, 2012

    Anonymous

    Bravo, istinski gresoht reportaj ot mqstoto na sabitieto, dokumentiran s aktualni snimki (nqmam predvid bombandirovkite v Belgad, razbira se, a protestite sreshtu NATO vav Freiburg)! Silno me valnuva kakvo biha predprieli s tezi tankoobrazni mashini chengetata
  2. Jun 12, 2012

    Anonymous