Skip to end of metadata
Go to start of metadata

Apstrata provides a server scripting API to interact with social networks in general, and Twitter 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 Twitter, already have API calls available from the scripting environment, under the “apsdb.social.twitter” object.

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

  • getRequestToken
  • getAccessToken
  • tweet
  • getHomeTimeline
  • getHomeTimeLineUrl
  • callApi
  • getApiCall

 

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

  • getRequestToken(consumerKey, consumerSecret, callbackUrl)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.
    callbackUrl: the url twitter will redirect to after the user authorizes the application

    This method returns an object containing the authorization url and a pair of request token/secret

  • getAccessToken(consumerKey, consumerSecret, requestToken, requestTokenSecret, oAuthVerifier)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.
    requestToken/requestTokenSecret: a pair (returned from the getRequestToken) which identifies the user's request
    oAuthVerifier: the verifier parameter returned by twitter 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 a pair of access token / access token secret

  • tweet(consumerKey, consumerSecret, accessToken, accessTokenSecret, tweetString)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.

    accessToken/accessTokenSecret: a pair identifying the users, obtained as a result of calling getAccessToken and a successful authorization operation
    tweetString: the new status to post to the twitter account, identified by the pair of access tokens

    This method does not return a value


  • getHomeTimeLine(consumerKey, consumerSecret, accessToken, accessTokenSecret)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.
    accessToken/accessTokenSecret: a pair identifying the users, obtained as a result of calling getAccessToken and a successful authorization operation

    This method returns the home time line of the user identified by the provided pair of access tokens


  • getHomeTimeLineUrl(consumerKey, consumerSecret, accessToken, accessTokenSecret)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.
    accessToken/accessTokenSecret: a pair identifying the users, obtained as a result of calling getAccessToken and a successful authorization operation

    This method returns the url to call in order to obtain the home time line of the user identified by the provided pair of access tokens

  • callApi(consumerKey, consumerSecret, accessToken, accessTokenSecret, verbString, resourceUrl, parameters)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.
    accessToken/accessTokenSecret: a pair identifying the users, 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 twitter API call in JSON format 

    Note: For more details about the "resourceUrl" and "parameters" arguments, please refer to https://dev.twitter.com/docs/api
     
  • getApiCall(consumerKey, consumerSecret, accessToken, accessTokenSecret, verbString, resourceUrl, parameters)

    consumerKey/consumerSecret: key pair provided by twitter when creating the application. This pair identifies the application.
    accessToken/accessTokenSecret: a pair identifying the users, 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 https://dev.twitter.com/docs/api 
  • No labels