I intend to call a POST API, it requires a form-data as the body to be sent. I need help on how to send form-data. Following is how I am calling the api:
static URL url;
static HttpURLConnection conn;
static String response;
url = new URL("http://" + ApiConfig.URL + endpoint);
System.out.println("URL: " + url);
conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setConnectTimeout(3000);
conn.setReadTimeout(5000);