User’s current session information

Description of server request parameters and a sample response:

Attention: All examples in the documents contain the data not carrying any actual information!

The request enables receiving user’s current session information

Limit on inquiries per minute: Unlimited

HTTPS GET

HTTPS POST  (For API V2)

Request:

{
    "cmd" (string)   : "getSidInfo",
    "SID" (string)   : "[SID by authorization]",
    "params" (array) : {}
}

Description of request parameters:
Base parameter Parameter Type Description
cmd   string Request execution command
SID   string SID received during the user's authorization
params   array Request execution parameters

Response:

Getting a response if successful.

{
  "SID" (string)   : "[SID by authorization]",
  "user_id"  (int) : 2011111110
}
    

We get an answer in case of failure

// Common error
{
    "errMsg" : "Bad json",
    "code"   : 2
}

// Method error
{
    "error" : "User is not found",
    "code"  : 7
}


Description of response parameters:
Base parameter Parameter Type Description
code   int Code error. The meaning of the codes can be viewed on the page "A list of the codes and errors"
errMsg   string A description of general error. The meaning of the errors can be viewed on the page "A list of the codes and errors"
error   string Error description
SID   string Session ID or null if no active session is available
user_id   int User ID

Examples of using

This example was made using open source library jQuery
  • JS (jQuery)

    /**
     * @type {getSidInfo}
     */
    var exampleParams = {
        "cmd"    : "getSidInfo",
        "SID"    : "[SID by authorization]",
        "params" : {}
    };
    
    function getSidInfo(callback) {
        $.getJSON("https://tradernet.com/api/", {q: JSON.stringify(exampleParams)}, callback);
    }
    
    /**
     * Get the object **/
    getSidInfo(function(json){
        console.log(json);
    });