API Documentation
The ocGram API Platform can be used to build non-automated, authentic, high-quality apps and services.
SECTIONS:
B. How to Retrieve Access Token
C. Endpoints
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
- Server-side (Explicit) Flow
Step One: Direct your user to our Authorization URLhttp://ocgram.bukausahaonline.com/index.php?route=account/app_client_authorization&app_client_key=APP-CLIENT-KEY&redirect_uri=REDIRECT-URI&response_type=codeStep Two: Retrieve the redirect from ocGramhttp://your-redirect-uri?code=CODEStep 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
- Client-side (Implicit) Authentication
Step One: Direct your user to our Authorization URLhttp://ocgram.bukausahaonline.com/index.php?route=account/app_client_authorization&app_client_key=APP-CLIENT-KEY&redirect_uri=REDIRECT-URI&response_type=tokenStep Two: Retrieve the access_token via the URL fragmenthttp://your-redirect-uri#access_token=ACCESS-TOKENSimply grab the access_token off the URL fragment and you’re good to go.
- Users http://ocgram.bukausahaonline.com/index.php?route=api/v1/getcustomer&access_token=ACCESS-TOKEN
- Posts http://ocgram.bukausahaonline.com/index.php?route=api/v1/getcustomerposts&access_token=ACCESS-TOKEN&limit=LIMIT