Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

...

The goal of basic API is to allow access to feedback and all the basic features of eKomi. The Basic API can be downloaded below:

View file
nameeKomi_APIv3_documentation_ENT.pdf
height250

1. CSV API

1.1 Security

1.1.1 POST User Login

...

This call allows you to get an Authorization token that will allow you to access other APIs in the ARI tool.

<?php

$curl = curl_init();

$apiEndPoint = 'https://ari.ekomiapps.dev/api/1.0/security/login';
$ekomiConnectUsername = 'username';
$ekomiConnectPassword = 'password';

curl_setopt_array($curl, array(
    CURLOPT_URL => $apiEndPoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => '{"username": "'.$ekomiConnectUsername.'", "password": "'.$ekomiConnectPassword.'"}',
    CURLOPT_HTTPHEADER => array(
        'cache-control: no-cache',
        'content-type: application/json',
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo 'cURL Error #:' . $err;
} else {
    $json = json_decode($response, true);
    echo $json['accessToken'];
}

Reviews

For this API to work, the eKomi Connect must have this role assigned to his account: ARI_POST_REVIEW

Please note that a new endpoint is added for POST review which accepts productReviewTitle: https://ari.ekomiapps.dev/api/1.1/reviews

Example call:

<?php

$curl = curl_init();

$apiEndPoint = 'https://ari.ekomiapps.dev/api/1.0/reviews';

// You get this token when you call the login API
$ekomiConnectAccessToken = 'MnRlMjJlNDE5ZTdlMjFmZTdlNmIzOGQ1OGZkYjA2NjYwMzBmZmQ0OTIyNmM1ODM2ODg1Mjk0ODU2NTY2MGVlNQ';

// Those parameters are mandatory
$curlOptPostFields = [];
$curlOptPostFields['inputSourceId'] = 2; // The ID of the input source (created in the ari tool admin)
$curlOptPostFields['orderId'] = 'test-12'; // The order ID
$curlOptPostFields['rating'] = 4; // Review rating
$curlOptPostFields['reviewText'] = 'This is lorem'; // Review text
$curlOptPostFields['transactionDate'] = '2004-02-12T15:19:21+00:00'; // ISO 8601 date
$curlOptPostFields['shopId'] = '12345'; // Account Id
// Those parameters are optional $curlOptPostFields['clientId'] = 1234; // The client’s id by which the client shall be registered. Must be alpha-numeric.
$curlOptPostFields['email'] = 'abdel@example.com'; // Clients contact email address


curl_setopt_array(
    $curl,
    array(
        CURLOPT_URL => $apiEndPoint,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => json_encode($curlOptPostFields),
        CURLOPT_HTTPHEADER => array(
            'authorization: ekomi '.$ekomiConnectAccessToken,
            'cache-control: no-cache',
            'content-type: application/json',
        ),
    )
);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo 'cURL Error #:'.$err;
} else {
    $json = json_decode($response, true);
    print_r($json);
}



8. Special Authentication API

...