At the moment our example code is very sparse, but we do hope the api is simple enough for that to not be too much of a problem.

The API in the real world

The ScubaTribe API is used to power the ScubaTribe facebook App, which shows a clients reviews on a tab inside their account
Take a look at the Facebook app as used by Dive-careers.com

We are also aware of at least one dive shop management suite which is currently integrating ScubaTribe and of a couple of CMS plugins in the works.

Simple PHP examples

Request the clients feedback summary

                       

<?php
      
//build query
      
$url  'https://api.scubatribe.com/v1/';
      
$url .= 'reviews/summary';
      
$apiKey 'MYSCUBATRIBEAPIKEY';
      
$ch curl_init();
      
curl_setopt($chCURLOPT_URL$url);
      
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
      
//set the http verb
      
curl_setopt($chCURLOPT_CUSTOMREQUEST'GET');
      
//Set some http headers
      
$httpHeader = array('Accept: application/json',
                           
'API-KEY: ' $apiKey);
      
curl_setopt($chCURLOPT_HTTPHEADER$httpHeader);

      
//make the request with curl
      
$result   curl_exec($ch);
      
$httpCode curl_getinfo($chCURLINFO_HTTP_CODE);
      
curl_close($ch);

      
//decode the JSON into an array
      
$result json_decode($resulttrue);

Sample Response:

      {
          "results": {
              "numReviews": 44,
              "rating": 4.39,
              "recommend": 98,
              "distribution": {
                  "5": {
                      "count": 23,
                      "percent": 52
                  },
                  "4": {
                      "count": 16,
                      "percent": 36
                  },
                  "3": {
                      "count": 4,
                      "percent": 9
                  },
                  "2": {
                      "count": 1,
                      "percent": 2
                  },
                  "1": {
                      "count": 0,
                      "percent": 0
                  }
              }
          },
          "num_records": 4,
          "status": "OK"
      }
                       

Post a reply to a review on behalf of a client

                       

<?php
      
//Over simplified text source
      
$text      $_POST['text'];
      
$review_id $_POST['review_id'];
      
//build query
      
$url  'https://api.scubatribe.com/v1/';
      
$url .= 'reviews/'.$review_id.'/comment';
      
$apiKey 'MYSCUBATRIBEAPIKEY';
      
$ch curl_init();
      
curl_setopt($chCURLOPT_URL$url);
      
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
      
//Add the fields to POST
      
$post_fields =array('text'=> $text);
      
curl_setopt($chCURLOPT_POSTtrue);
      
curl_setopt($chCURLOPT_POSTFIELDShttp_build_query($post_fields));
      
//set the http verb
      
curl_setopt($chCURLOPT_CUSTOMREQUEST'POST');
      
//Set some http headers
      
$httpHeader = array('Accept: application/json',
                           
'API-KEY: ' $apiKey);
      
curl_setopt($chCURLOPT_HTTPHEADER$httpHeader);

      
//make the request with curl
      
$result   curl_exec($ch);
      
$httpCode curl_getinfo($chCURLINFO_HTTP_CODE);
      
curl_close($ch);

      
//decode the JSON into an array
      
$result json_decode($resulttrue);

Sample JSON Response:

    {
        "message": "Comment Added",
        "new_comment_count": 3,
        "status": "OK"
    }
                       
Back to Top