Skip to main content

Basic Commands

The SDK commands below are designed to conduct basic SDK operations:

Set API domain​

Sets the SDK to use your back-end's domain name. Please head to https://app.vpnwholesaler.com/credentials in order to retrieve your API base domain name.

Important

Please use the domain name only without scheme (i.e. do not include https://)

Login required: No

CmdProc Code: OVS_CMD_SET_API_DOMAIN

Command number: 9

Input:

{
"api_domain": "your_subdomain.vpngn.com"
}

Response: OVS_NOTIFY_SET_API_DOMAIN

OVS_NOTIFY_SET_API_DOMAIN Successful response
    OVS_ERR_OK

data is null

Code sample:

macOS Code Sample
void SetAPIDomain(const char *api_domain)
{
json_object *j_obj, *j_data_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_SET_API_DOMAIN));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "api_domain", json_object_new_string(api_domain));
json_object_object_add(j_obj, "data", j_data_obj);
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}

Set Logger Mode​

Enable or disable log file creation. Logging is disabled by default.

Login required: No

CmdProc Code: OVS_CMD_SET_LOGGING

Command number: 26

Input:

{
"status": true | false
}

Response: OVS_NOTIFY_SET_LOGGING

OVS_NOTIFY_SET_LOGGING Successful response
    OVS_ERR_OK

data is null

Code sample:

macOS Code Sample
    void SetLogging(bool status)
{
json_object *j_obj, *j_data_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_SET_LOGGING));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "status", json_object_new_boolean(status));
json_object_object_add(j_obj, "data", j_data_obj);
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}

Login​

Logins to the back-end and retrieves active products associated with the given user.

Login required: No

CmdProc Code: OVS_CMD_LOGIN

Command number: 1

Input:

{
"username": "end_user_email_address",
"password": "end_user_password"
}

Username - End-user's username

Password - End-user's password

Response: OVS_NOTIFY_LOGIN

OVS_NOTIFY_LOGIN Successful response
    OVS_ERR_OK

Data contains information about user account and account status:
nextduedate - Plan renewal date
username - OpenVPN username
password - OpenVPN password
status - Account status
name - User's first name
email - User's email address
debug - Debug mode?
free - Free plan?

Code sample:

macOS Code Sample
    void Login(const char *username, const char *password)
{
json_object *j_obj, *j_data_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_LOGIN));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "username", json_object_new_string(username));
json_object_object_add(j_data_obj, "password", json_object_new_string(password));
json_object_object_add(j_obj, "data", j_data_obj);
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}

Logout​

Logs out a currently logged-in end-user.

Login required: Yes

CmdProc Code: OVS_CMD_LOGOUT

Command number:

Input: Not required

Response: OVS_NOTIFY_LOGOUT

OVS_NOTIFY_LOGOUT Successful response
    OVS_ERR_OK

data is null

Code sample:

Windows Code Sample
    void Logout()
{
json_object *j_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_LOGOUT));
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}