Java
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class IpoFetcher {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.ipoalerts.in/ipos?status=open")
.addHeader("x-api-key", "your_api_key_here")
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
String responseData = response.body().string();
System.out.println(responseData);
} else {
System.err.println("Request failed: " + response.code());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}