Authentication

Authenticate your developer account by including your secret VSETA Application Access Key ID in API requests. Your API Access Key ID may carry many privileges, so be sure to keep it secure!

Use your unique Access Key ID to obtain  apiToken for each request.

All API requests must be made over HTTPS. API requests without authentication will fail.


Request SessionToken

var sessionToken = JSON.stringify([{"name":"username","value":userName},{"name":"usercertificate","value":userCertificate},{"name":"accessKeyId","value":accessKeyId}]);

Developer Account: 

VSETA Developer userCertificate is static, but for security reasons it may change or expire over time.

//Use Your Unique Developer Account to build any applications.

var userName = "your_dev_account@domain.com";

var userCertificate = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX";

Application AccessKeyId:

Your VSETA Application accessKeyId will be provided to you upon developer API Token request by your organization's admin.

var accessKeyId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX";


Authenticate

//***** VSETA API ACCESS *****
        
//Use Your Developer Account
var userName = "your_dev_account@domain.com";
var userCertificate = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX";

//Application API Account Key - Do Not Share your ID.
var accessKeyId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX";

//Add accessKeyId to User Login for Authentication
var sessionToken = JSON.stringify([{"name":"username","value":userName},{"name":"usercertificate","value":userCertificate},{"name":"accessKeyId","value":accessKeyId}]);

//************************************

$.ajax({
    type: "POST",
    dataType: "json",
    contentType : "application/json",
    url: "https://ai.vseta.com/auth/",
    data: sessionToken, 
    success: function(data){
           
        //Modify the SessionToken parameters according to VSETA API Documentation
         var apiToken = JSON.stringify([{sessionToken:data[0].SessionToken},{propertyid:propertyId},{accessKeyId:accessKeyId}])
                     
        //Call various VSETA APIs using apiToken, which includes valid SessionToken
          $.ajax({
            type: "POST",
            dataType: "json",
            contentType : "application/json",
            url: "https://ai.vseta.com/<endpoint>/",
            data: apiToken,
            success: function(data){
                //URL: Modify URL according to VSETA API Documentation to access various subscribed Restful APIs.
                //success: Success Returns JSON Array Object if accessKeyId is valid for the called Restful API resource.
            },
            failure: function(errMsg) {
                console.log("ERROR: "+ errMsg);
            }
        });
    },
    failure: function(errMsg) {
        console.log("ERROR: "+ errMsg);
    }
});