API Documentation

The ocGram API Platform can be used to build non-automated, authentic, high-quality apps and services.

Register Your Application


SECTIONS:

A. User Authentication

B. How to Retrieve Access Token

  1. Server-side (Explicit) Flow
  2. Client-side (Implicit) Authentication

C. Endpoints

  1. Users
  2. Posts



A. User Authentication 

The ocGram API requires authentication - specifically requests made on behalf of a user. Authenticated requests require an access_token. These tokens are unique to a user and should be stored securely. Access tokens may expire at any time in the future.

B. How to Retrieve Access Token 

  1. Server-side (Explicit) Flow 

    Step One: Direct your user to our Authorization URL

    http://ocgram.bukausahaonline.com/index.php?route=account/app_client_authorization&app_client_key=APP-CLIENT-KEY&redirect_uri=REDIRECT-URI&response_type=code
    Step Two: Retrieve the redirect from ocGram

    http://your-redirect-uri?code=CODE
    Step Three: Request the access_token

    This is a sample request:

    $service_url = 'http://ocgram.bukausahaonline.com/';
    $app_client_key = 'APP-CLIENT-KEY';
    $app_client_secret = 'APP-CLIENT-SECRET';
    $grant_type = 'authorization_code';
    $redirect_uri = 'REDIRECT-URI';
    $code = 'CODE';

    // cUrl Start
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => $service_url . "index.php?route=api/v1/getaccesstoken",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "app_client_key=" . $app_client_key . "&app_client_secret=" . $app_client_secret . "&grant_type=" . $grant_type . "&redirect_uri=" . $redirect_uri . "&code=" . $code . "",
    CURLOPT_HTTPHEADER => array(
    "content-type: application/x-www-form-urlencoded",
    "key: none"
    ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    // cUrl end


  2. Client-side (Implicit) Authentication 

    Step One: Direct your user to our Authorization URL

    http://ocgram.bukausahaonline.com/index.php?route=account/app_client_authorization&app_client_key=APP-CLIENT-KEY&redirect_uri=REDIRECT-URI&response_type=token
    Step Two: Retrieve the access_token via the URL fragment

    http://your-redirect-uri#access_token=ACCESS-TOKEN
    Simply grab the access_token off the URL fragment and you’re good to go.

C. Endpoints 

  1. Users 

    http://ocgram.bukausahaonline.com/index.php?route=api/v1/getcustomer&access_token=ACCESS-TOKEN
  2. Posts 

    http://ocgram.bukausahaonline.com/index.php?route=api/v1/getcustomerposts&access_token=ACCESS-TOKEN&limit=LIMIT