Get API Access

After login to Explara https://www.explara.com/a/login, go to 'API & Developers'.
Explara supports OAuth2 specification to enable access to APIs. Explara provides 2 ways to authenticate & access.

User Access

Explara users can use this approach to directly connect and use Explara API.You need ‘Access Token”, get your access token from 'API & Developers'

App Access

As an Apps developer or user wants to access API via app access, you have to first register your application with Explara. Go to ‘API & Developers’ page and create an application as shown in the following diagram.

You will get Application Client Id and Client secret. Save it for future use

Application Integration

The following steps explain how to integrate Explara’s OAuth2 with your application.

1. User Authorization (Get User authorize code)

In your application, show a button called 'Login with Explara' and send the request to https://www.explara.com/a/account/oauth/authorize?response_type=code&client_id=yourAppClientId&state=event'
The above request is to authorize user or to get user’s authorization code.

After user’s successful authorization, it will return authorize code to your registered callback URL.

2.Get access token for authorized code.

To get the access token for the authorize code. You have to send POST request to the URL : https://www.explara.com/a/account/oauth/token with following parameters.
a) client_id : App client id
b) client_secret: app client secret
c) grant_type : authorization_code
d) code : authorization code

Note: only POST method is allowed.

Example:

$request_string = 'client_id=appClientId&client_secret=appClientSecret&grant_type=authorization_code&code=userAuthorizeCode';
$url = https://account.explara.com/account/oauth/token ;
$ch = curl_init($url) ;
curl_setopt($ch, CURLOPT_POSTFIELDS,$request_string);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT,30);
curl_setopt($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
$response_data= json_decode(urldecode($response),true);

The above $response_data contains the token. With the token, you can now call any Explara API methods. The token will be valid for 3 months; in future following the same process, user could give you access to their Explara data.

To access Explara API you need access token.

NOTE :All requests with OAuth2 tokens must be made over SSL. Additional request headers are required when using access_tokens to use Explara API: “Authorization: Bearer YOUR_ACCESS_TOKEN_HERE“.