Java Integration

First, let's get your SECRET_KEY. Go to config.php of Blackout and look for the text: define('SECRET_KEY', 'XXXXXXXXXXXXX'); and copy it.

Now let's verify what level of security you are using. Go to config.php and look for define('API_SECURITY', 0); check between 0, 1, and 2. If it is 1, you only need the secret_key. If it is 2, you need to generate a request code on your dashboard. If it is 3, you need to get the SECRET_KEY of your software account and verify that you have the permission dbb.admin.request.validation or dbb.*.

If you have everything, let's proceed to write the code. Note that this applies to all other code.

Create a License

Use this JAVA example to generate a license via API requests. Requirements:

  • CLIENT (The client ID. This can only be the DISCORD_ID or the SOFTWARE_ID of the registered user.)

  • PRODUCT (You need to verify which product you want this to be for, remember to check products to see if it exists and what the ID_name is.)

  • EXPIRE (This only applies in DAYS. You can put a number between 1 to greater.)

  • MAXIPS (This is to know how many MAX IPS this license wants to have. It can be 1 or more.)

  • BOUND (Force this key to use the PRODUCT.)

  • CUSTOM_ADDONS (This must be together and separated by # for example: unlimited#dbb#debugg etc. [No limit.]

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class LicenseGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "license";
        String client = "623308343582130187";
        String product = "Blackout";
        String expire = "15";
        String maxips = "10";
        String bound = "1";
        String custom_addons = "addon1#addon2#addon3#addon4";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("client", client);
        params.put("product", product);
        params.put("expire", expire);
        params.put("maxips", maxips);
        params.put("bound", bound);
        params.put("custom_addons", custom_addons);

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

Create a Product

Use this JAVA example to generate a product via API requests. Requirements:

  • NAME (Form of specifying the software name on the site for preview.)

  • ID_NAME (The identifier of the plugin name. This is mandatory for successful verification.)

  • DESCRIPTION (It is optional, but you can leave a description up to 75 letters.)

  • PRICE (It is optional. You can set a price to calculate your earnings through the generated keys.)

  • VERSION (It is optional. This option can be used to make UPDATES and keep control of the obligation to use the latest versions.)

  • TEBEX (It is optional. It only works if you have tebex enabled. Otherwise, it doesn't matter what you put, it will be NULL.)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class ProductGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "product";
        String name = "Blackout";
        String id_name = "Blackout-v1.5.3-BETA";
        String description = "";
        String price = "5.50";
        String version = "1.5.3-BETA";
        String tebex = "addon1#addon2#addon3#addon4";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("name", name);
        params.put("id_name", id_name);
        params.put("description", description);
        params.put("price", price);
        params.put("version", version);
        params.put("tebex", tebex);

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

Create a User

Use this JAVA example to generate a user via API requests. Requirements:

  • USERNAME (The username. This is a subname for the software.)

  • PASSWORD (If you put a password, you have to encode it in MD5. Only in version 1.5.3)

  • EMAIL (The user's email. It is mandatory.)

  • UDID (The user's Discord ID. It must be DISCORD_ID obligatorily.)

  • AVATAR (The URL of the user's avatar. It is mandatory.)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class UserGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "user";
        String name = "Vuhp";
        String password = "";
        String email = "juanmpanizzino@gmail.com";
        String udid = "623308343582130187";
        String avatar = "";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("username", name);
        params.put("password", password);
        params.put("email", email);
        params.put("udid", udid);
        params.put("avatar", avatar);

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

Create a Group

Use this JAVA example to generate a group via API requests. Requirements:

  • NAME (The name for the group. Mandatory.)

  • COLOR (It is optional. You can put a color only with #028000 or any HEX code of your preference. It is mandatory to use HEX for others and must carry the # at the beginning.)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class GroupGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "group";
        String name = "Developer";
        String color = "#028000";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("name", name);
        params.put("color", color);

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

Create a Group Permission

Use this JAVA example to generate a permission via API requests. Note that creating a group is the first step to obtain the ID of it. After obtaining the ID, we will place it in group = ''. Requirements:

  • GROUP (The ID of the group.)

  • PERMISSION (The permission to insert.)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class GroupPermissionGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "group_permission";
        String group = "6";
        String permission = "dbb.*";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("group", group);
        params.put("permission", permission);

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

Create a Group User

Use this PHP example to insert a user via API requests. Note that creating a group is the first step to obtain the ID of it. After obtaining the ID, we will place it in group = ''. Requirements:

  • GROUP (The ID of the group.)

  • USER (The ID of the user.)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class GroupUserGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "group_user";
        String group = "6";
        String user = "1";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("group", group);
        params.put("user", user);

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

Create a Code

Use this JAVA example to insert a user via API requests. This only works for LICENSE and ADDONS codes. Request codes will have to be generated manually. Requirements:

  • LICENSE OPTION

    • SUBTYPE (Option of the code [license / addons] In this case 'license'.)

    • PRODUCT (The name of the product.)

    • MAXIPS (The maximum IPs for the license.)

    • EXPIRE (Expiration in days, place a number greater than 1.)

  • ADDONS OPTION

    • SUBTYPE (Option of the code [license / addons] In this case 'addons'.)

    • ADDONS (It is mandatory and all must be placed in order and without spaces. For example: option1#option2#option.3#optio.ns4 etc.)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class CodeGenerator {
    public static void main(String[] args) {
        String domain = "license.devbybit.com";
        String secret = "PUT_YOUR_SECRET_KEY";
        String type = "create";
        String table = "code";
        String subtype = "license";
        String product = "Blackout";
        String maxips = "15";
        String expire = "366";
        String addons = "Options1#Unlimited#option..23#Option/15";

        Map<String, String> params = new HashMap<>();
        params.put("secret", secret);
        params.put("type", type);
        params.put("table", table);
        params.put("subtype", subtype);
        params.put("product", product);
        params.put("maxips", maxips);
        params.put("expire", expire);
        // params.put("addons", addons); // Use this? Remove: product, maxips & expire.

        String urlString = "https://" + domain + "/api.php?" + params.entrySet().stream()
                .map(entry -> entry.getKey() + "=" + entry.getValue())
                .collect(Collectors.joining("&"));

        try {
            URL url = new URL(urlString);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }

            in.close();
            con.disconnect();

            // Print the response
            System.out.println("Response: " + content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Perfect! It seems that everything went correctly. Now it remains to adjust the code to your liking.

I hope this helps with your project. Keep in mind that these are example codes and are not solid bases well done. But it is an example to learn the functionality and adapt your codes.


Done.

Last updated