User Management
Manage users directly from the SDK. Please note that the Account Management API must be set (OVS_CMD_SET_API_KEY) before invoking any of the commands.
Set Account Management API keyβ
The Account Management API key needs to be set before you can undertake any Account Management actions. Please head to https://app.vpnwholesaler.com/credentials in order to retrieve your API key.
Login required: No
CmdProc Code: OVS_CMD_SET_API_KEY
Command number: 10
Input:
{
"api_domain": "your_api_key"
}
Response: OVS_NOTIFY_SET_API_KEY
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void SetAPIKey(const char *api_key)
{
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_KEY));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "api_key", json_object_new_string(api_key));
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);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_SET_API_KEY, callback, "your_api_key");
VPNSDK.CmdProc(β{\βcmd\β: 10, \βdata\β : { \βapi_key\β : \βyour_api_key\β}}β);
Add Clientβ
Add a new client on the back-end, including a new product.
Do not use on Existing Users
Using Add Client on existing users will result in an error. Please use 'New Product' instead.
caution
The AddClient endpoint is rate-limited for 1 client per 10 seconds unless it is sent from a whitelisted IP address
Login required: No
CmdProc Code: OVS_CMD_ADD_CLIENT
Command number: 21
Input:
{
"email": "user_name@domain.com",
"password": "user_password",
"countrycode": "US",
"type": "12",
"first_name": "",
"last_name": "",
"company_name": ""
}
email - end-user's email address
password - end-user's password (a random password fill be generated if no password is given)
countrycode - end-user's two-characters ISO country code
type - end-user's account plan - please refer to the API ID column at https://app.vpnwholesaler.com/plans
first_name - optional - Client's first name
last_name - optional - Client's last name
company_name - optional - Client's company name
Response: OVS_NOTIFY_ADD_CLIENT
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
OVS_ERR_FAILED_ADD_CLIENT
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void AddClient(const char *email, const char *password, const char *countrycode, const char *type)
{
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_ADD_CLIENT));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "email", json_object_new_string(email));
json_object_object_add(j_data_obj, "password", json_object_new_string(password));
json_object_object_add(j_data_obj, "countrycode", json_object_new_string(countrycode));
json_object_object_add(j_data_obj, "type", json_object_new_string(type));
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);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_ADD_CLIENT, callback, "user_name@domain.com", "password", "US", "1", "John", "Jackson", "Jackson Ltd");
VPNSDK.CmdProc("{\"cmd\": 21, \"data\": {\"email\": \"user_name@domain.com\", \"password\": \"password\", \"countrycode\": \"US\", \"type\": \"1\", \"first_name\": \"John\", \"last_name\": \"Jackson\", \"company_name\": \"Jackson Ltd\"}}");
New Productβ
Add the product to an existing end-user's account on the back-end.
Do not use on New Users
The Add Client endpoint above already creates a product. Therefore, the New Product endpoint is not needed for new users.
Login required: Yes
CmdProc Code: OVS_CMD_NEW_PRODUCT
Command number: 59
Input:
{
"type": "12"
}
type - end-user's account plan - please refer to the API ID column at https://app.vpnwholesaler.com/plans
Response: OVS_NOTIFY_NEW_PRODUCT
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
data is null
Code sample:
- Android
- Android (JSON)
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_NEW_PRODUCT, callback, "12");
VPNSDK.CmdProc("{\"cmd\": 59, \"data\": { \"type\": \"12\"}}");
Change Planβ
Changes the end-user's plan on the back-end.
Login required: Yes
CmdProc Code: OVS_CMD_CHANGE_PLAN
Command number: 50
Input:
{
"email": "test@mail.com",
"type": "12"
}
email - end-user's email address
type - end-user's account plan - please refer to the API ID column at https://app.vpnwholesaler.com/plans
Response: OVS_NOTIFY_CHANGE_PLAN
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
data is null
Code sample:
- Android
- Android (JSON)
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_CHANGE_PLAN, callback, "user_name@domain.com", "12");
VPNSDK.CmdProc("{\"cmd\": 50, \"data\": {\"email\": \"user_name@domain.com\", \"type\": \"12\"}}");
Cancel Planβ
Terminate the end-user's main account at the end of the billing period (at_due_date), including all products and aliases.
Login required: Yes
CmdProc Code: OVS_CMD_CANCEL_PLAN
Command number: 58
Input:
Empty
Response: OVS_NOTIFY_CANCEL_PLAN
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
data is null
Close Clientβ
Terminate the end-user's main account immediately, including all products and aliases.
Login required: No
CmdProc Code: OVS_CMD_CLOSE_CLIENT
Command number: 22
Input:
{
"email": "user_name@domain.com",
}
email - end-user's email address
Response: OVS_NOTIFY_CLOSE_CLIENT
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void CloseClient(const char *email)
{
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_CLOSE_CLIENT));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "email", json_object_new_string(email));
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);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_CLOSE_CLIENT, callback, "user_name@domain.com");
VPNSDK.CmdProc("{\"cmd\": 22, \"data\": {\"email\": \"user_name@domain.com\"}}");
Get Account Typeβ
Returns the end-user's current active plan.
Login required: Yes
CmdProc Code: OVS_CMD_GET_ACCOUNT_TYPE
Command number: 18
Input:
{
"email": "user_name@domain.com",
}
email - end-user's email address
Response: OVS_NOTIFY_GET_ACCOUNT_TYPE
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void GetAccountType()
{
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_GET_ACCOUNT_TYPE));
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_GET_ACCOUNT_TYPE, callback);
VPNSDK.CmdProc("{\"cmd\": 18}");
Get Account Credentialsβ
Returns the current end-user's OpenVPN Credentials
Login required: Yes
CmdProc Code: OVS_CMD_GET_ACCOUNT_CREDENTIAL
Command number: 19
Input: Not required
Response: OVS_NOTIFY_GET_ACCOUNT_CREDENTIAL
- Success
- Failure
OVS_ERR_OK
data will include
{
"username": "",
"password": ""
}
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void GetAccountCredentials()
{
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_GET_ACCOUNT_CREDENTIAL));
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_GET_ACCOUNT_CREDENTIAL, callback);
VPNSDK.CmdProc("{\"cmd\": 19}");
Get Account Expiration Dateβ
Returns the expiration date for the current end-user's account
Login required: Yes
CmdProc Code: OVS_CMD_GET_ACCOUNT_EXP_DATE
Command number: 20
Input: Not required
Response: OVS_NOTIFY_GET_ACCOUNT_EXP_DATE
- Success
- Failure
OVS_ERR_OK
data will include
{
"exp_date": "2030-12-31",
}
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void GetAccountExpDate()
{
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_GET_ACCOUNT_EXP_DATE));
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_GET_ACCOUNT_EXP_DATE, callback);
VPNSDK.CmdProc("{\"cmd\": 20}");
Reset Passwordβ
Initiates a password reset request for the specified end-user. If successful, the end-user shall recieve an email with a new password.
Login required: No
CmdProc Code: OVS_CMD_RESET_PASSWORD
Command number: 23
Input:
{
"email": "user_name@domain.com",
}
Response: OVS_NOTIFY_RESET_PASSWORD
- Success
- Failure
OVS_ERR_OK
data is null
OVS_ERR_MISSING_PARAMS
OVS_ERR_WEB_API
data is null
Code sample:
- macOS
- Android
- Android (JSON)
void ResetPassword(const char *email)
{
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_RESET_PASSWORD));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "email", json_object_new_string(email));
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);
}
VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
@Override
public void onNotify(int notification, int error, Object data) {
if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
// Do something when command is successful
} else {
// Process error
}
}
};
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_RESET_PASSWORD, callback, "user_name@domain.com");
VPNSDK.CmdProc("{\"cmd\": 23, \"data\": {\"email\": \"user_name@domain.com\"}}");