Get Satisfaction

Get Satisfaction’s REST API provides a technical way to access community data, which lets third-party tools interact with our platform. The API follows REST conventions for URL construction, and can return data in JSON format. Acceptable use of the service and API are covered in our Terms of Service. For general discussion about the API, please join the Get Satisfaction developer community at: https://getsatisfaction.com/devcommunity.

Authentication

The first thing we want to do is get an app key and app secret. This can be acheived by logging into Get Satisfaction Clicking FastPass. We can next plug in both of those to start an authentication process as in Figure 1.

Figure 1. Instantiate Auth
$auth = eden('getsatisfaction')->auth('[CONSUMER_KEY]', '[CONSUMER_SECRET]');

With this auth class let's make sure we can generate a login URL. Figure 2 is used to redirect the user to twitter to continue the authentication.

Figure 2. Get Login URL
//user will need to go to inorder to complete the authenication process
$login = $auth->getLoginUrl('http://yourwebsite.com/auth');

All you need to do is replace http://yourwebsite.com/auth with the URL of your website and page you will be handling the Get Satisfaction authentication. When the user has authorized our app to use their data, Get Satisfaction will add a temporary auth token, we can use to transfer to an access token. Figure 3 shows how we can convert that auth token to an access token.

Figure 3. Get Token
$token = $auth->getAccess($_GET['oauth_token'], $_GET['getsatisfaction_token_secret']);
//lastly, save the token in session
$_SESSION['access_token'] 	= $token['oauth_token'];
$_SESSION['access_secret']  = $token['oauth_token_secret'];

An example of the whole entire authentication process can be found in Figure 4.

Figure 1. Authentication
session_start();

$auth = eden('getsatisfaction')->auth('[CONSUMER_KEY]', '[CONSUMER_SECRET]');

//if no code and no session
if(!isset($_GET['getsatisfaction_token_secret'], $_GET['oauth_token'], $_SESSION['token'])) {
    //redirect to login
    $login = $auth->getLoginUrl('http://yourwebsite.com/auth');
    header('Location: '.$login);
    exit;
}

//Code is returned back from google
if(isset($_GET['getsatisfaction_token_secret'], $_GET['oauth_token'])) {
    //save it to session
	$access = $auth->getAccess($_GET['oauth_token'], $_GET['getsatisfaction_token_secret']);
    $_SESSION['access_token'] = $access['oauth_token'];
    $_SESSION['access_secret'] = $access['oauth_token_secret'];
}

When we have our token we can then access the different service levels of Get Satisfaction.

Figure 2. Instantiate Get Satisfaction
$getsatisfaction = eden('getsatisfaction');
Figure 3. Get Satisfaction Methods
Method Arguments Returns Description
$getsatisfaction->company($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Company Returns Getsatisfaction Company
$getsatisfaction->detail($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Detail Returns Getsatisfaction Detail
$getsatisfaction->auth($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Oauth Returns Getsatisfaction OAuth
$getsatisfaction->people($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_People Returns Getsatisfaction People
$getsatisfaction->post($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Post Returns Getsatisfaction post
$getsatisfaction->product($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Product Returns Getsatisfaction Product
$getsatisfaction->replies($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Replies Returns Getsatisfaction Replies
$getsatisfaction->reply($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Reply Returns Getsatisfaction reply
$getsatisfaction->tag($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Tag Returns Getsatisfaction Tags
$getsatisfaction->topic($consumerKey, $consumerSecret, $accessToken, $accessSecret);
  1. string
  2. string
  3. string
  4. string
Eden_Getsatisfaction_Topic Returns Getsatisfaction Topics

© 2012 Openovate Labs. All rights reserved.