Skip to end of metadata
Go to start of metadata

Apstrata provides a server scripting API to interact with social networks in general, and Facebook in particular. All social networks providing APIs over http are accessible through server scripts using apsdb.callHttp server script API. However, popular networks, such as Facebook, already have API calls available from the scripting environment, under the “apsdb.social.facebook” object.

The following is the list of server scripting methods that allows you to interact with Facebook by invoking its APIs:

  • getRequestToken
  • getAccessToken
  • callApi
  • getApiCall

 

The following describes each of the available methods on the Facebook API:

  • getRequestToken(consumerKey, consumerSecret, callbackUrl, scope, state)

    consumerKey/consumerSecret: key pair provided by facebook when creating the application. This pair identifies the application.
    callbackUrl: the url facebook will redirect to after the user authorizes the application. Note, facebook requires that the url ends with a “/”
    scope: defines the scope that the user is requesting the tokens for. The scope defines the set of permissions the application will have
    state: a string that identifies the current user/request.

    This method returns an object containing the authorization URL. 
     
  • getAccessToken(consumerKey, consumerSecret, callbackUrl, oauthVerifier)

    consumerKey/consumerSecret: key pair provided by facebook when creating the application. This pair identifies the application.
    callbackUrl: the callbackUrl specified when calling getRequestToken. Note that facebook requires this parameter, and it should be the same as the one set when calling getRequestToken
    oAuthVerifier: the verifier parameter returned by facebook in response to an authorization. This verifier will be sent as a parameter when calling the callbackUrl specified when calling getRequestToken

    This method returns an object containing the access token
     
  • callApi(consumerKey, consumerSecret, accessToken, verbString, resourceUrl, parameters)

    consumerKey/consumerSecret: key pair provided by facebook when creating the application. This pair identifies the application.
    accessToken: token identifying the user, obtained as a result of calling getAccessToken and a successful authorization operation
    verbString: GET/POST/PUT
    resourceUrl: url identifying the API to call
    parameters: set of key/value pairs containing API specific parameters

    This method returns the response from the facebook API call in JSON format

    Note: For more details about the "resourceUrl" and "parameters" arguments, please refer to http://developers.facebook.com/docs/reference/api/

  • getApiCall(consumerKey, consumerSecret, accessToken, verbString, resourceUrl, parameters)

    consumerKey/consumerSecret: key pair provided by facebook when creating the application. This pair identifies the application.
    accessToken: token identifying the user, obtained as a result of calling getAccessToken and a successful authorization operation
    verbString: GET/POST/PUT
    resourceUrl: url identifying the API to call
    parameters: set of key/value pairs containing API specific parameters

    This method returns the url/formEncodedParams that needs to be called to get the network's response for the requested API

    Note: For more details about the "resourceUrl" and "parameters" arguments, please refer to http://developers.facebook.com/docs/reference/api/

  • No labels