Sarv.com

NODEJS

Choose Language

Account Calls

Info! This is Beta version, if you have any problem in using API, please mail us at support@sarv.com

/account/viewUserDetail

view User Details

Example Call

            
var sarv = require('./sarv.js');
var sarv_client = new sarv.Sarv('owner_id', 'token', 'SarvTES_APP_DOMAIN');
sarv_client.account.viewUserDetail({}, function(result) {
    console.log(result);
    /*
    {
        "status" : "success",
        "user_data" :   {
                            "name" : "john yu",
                            "email" : "john@sarv.com",
                            "mobile" : 9999999999,
                            "create_date" : 67457775764,
                            "allowed_speed" : 300,
                            "reputation" : "50%"
                        }
    }
     */
    
}, function(e) {
    // Sarv returns the error as an object with name and message keys
    console.log('A sarv error occurred: ' + e.name + ' - ' + e.message);
});  
            
            

Example Success Response


{
    "status" : "success",
    "user_data" :   {
                        "name" : "john yu",
                        "email" : "john@sarv.com",
                        "mobile" : 9999999999,
                        "create_date" : 67457775764,
                        "allowed_speed" : 300,
                        "reputation" : "50%"
                    }
}

Example Error Response


{
    "status"=> "error",
    "code"=> -1,
    "name"=> "AuthenticationError",
    "message"=> "Token MissMatch"
}

Parameters
owner_id* string a valid Sarv User Id
token* string a valid token
SarvTES_APP_DOMAIN* string a valid SarvTES APP DOMAIN
* compulsory field
Return Value: Success
struct the results of User Details
status string always success
user_data[]struct information of user details
name string user's name
email string user's email
mobile string user's mobile no.
allowed_speed integer user's allowed speed
reputation string user's reputation in %
create_date integer create date in seconds
Return Value: Error
struct the error results when attempt to get User Details
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. Sarv Developers will be notified.
AuthenticationError Provided owner_id and token was not matched.