Menu

Search

Electa Live Virtual Classroom, LMS - Help & Support Portal


API 2.1 - Authentication Token


Administrator
API 2.1

Each API call, no matter what namespace it refers to takes an authentication token as a parameter. The authentication token is a character value which is generated by a call to the authentication namespace.

This is the first call that has to be made before any other API calls are attempted as this will produce a session token needed for the other API calls.

The authentication system takes in the Account ID and the Application Key to authenticate the API call. It returns a Session Token that will be used for subsequent calls into the system.

The Session Token returned could be used multiple times within 20 minutes. This timeout is not configurable and is set to enforce a maximum level of security on sessions.

Not limited to authentication, all connections are suggested to be done over a secure channel. As an additional security control, the API access is automatically locked for 15 minutes after 5 failed login attempts.

All calls for obtaining authentication tokens must be made on a server-to-server communication level, not client-to-server. Do not pass the Application Key to the client browser.

 

Namespace Call

Authentication Namespace: /apps/token.asp
Supported HTML Methods: GET / POST
Communications Level: Server-to-Server

 

Parameters

Parameter Name

Data Type

Description

Optional

CID

Number

The Account Id available on the API Access page.
Sample Value: 12345

Required

AppKey

Character

The Application Key set on the API Access page.

Sample Value: UO86CN11XY73SF72TT40PG18ZE76VV71

Required

Result

Character

The response type to return.

Accepted values: csv or xml

If not specified an XML response type will be returned.

Optional

 

The Call Returns: An Integer Response Code and a character Session Token. If the call fails a non-zero response code is returned with an error description.

 

Example Call

http://www.e-lectazone.com/apps/token.asp?cid=123456&appkey=UO86CN11XY73SF72TT40PG18ZE76VV71&result=xml

 

Sample Successful XML Result

<Response>
    <
ResponseCode>0</ResponseCode>
    <
ResponseData>9C467079-FE3B-45C5-8AA5-9726397081AA</ResponseData>
</
Response>

 

Sample Unsuccessful XML Result

<Response>
    <
ResponseCode>1</ResponseCode>
    <
ResponseData>Invalid Account or Application Key</ResponseData>
</
Response>

 

Sample Successful CSV Result

0,EE5B4FCB-25D2-4267-AEB6-F10A1C9D0031

 

Sample Unsuccessful CSV Result

1,Invalid Account or Application Key

 

Obtaining a Session Token through PHP using CURL

<?
    $Url = 'https://www.e-lectazone.com/apps/token.asp?cid=123456&appkey=UO86CN11XY73SF72TT40PG18ZE76VV71&result=xml';

    if (!function_exists('curl_init')){
        die('cURL is not installed!');
    }

    $ch = curl_init();

    // Set URL to download and other parameters

    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);

    // Download the given URL, and return output
    $output = curl_exec($ch);
    // Close the cURL resource, and free system resources

    curl_close($ch);
?>

Sample ASP code snippet using WinHttp.WinHttpRequest

 

<%
    Dim objWinHttp
    Dim strHTML

    Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")

    SiteURL           = "https://www.e-lectazone.com"

    AccountId         = 11267192
    AppKey            = "UO86CN11XY73SF72TT40PG18ZE76VV71"
    Result            = "xml"
    AppRoot = SiteURL + "/apps/token.asp?cid=" & AccountId & "&appkey=" & AppKey & "&result=" & Result

    objWinHttp.Open "GET", AppRoot
    objWinHttp.Send

    strHTML = objWinHttp.ResponseText

    Set objWinHttp = Nothing

    Response.Write strHTML
%>


Also In This Category


Optionally provide private feedback to help us improve this article...

Thank you for your feedback!


Still have questions - Submit a new ticket
Details
Last Modified: 6 Months Ago
Last Modified By: Administrator
Type: INFO
Level: Expert
Rated 1 star based on 1 vote
Article has been viewed 529 times.
Options