#Send a cURL request help
12 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @young merlin! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
what does this have to do with java?
sorry, probably wasn't clear enough. I need to make the equivalent https request with java, but I've never worked with files.
URL url = "...";
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type","multipart/form-data");
connection.setRequestProperty("Accept", "application/json");```
but i don't know how to use the -F tag at all in java
try (OutputStream output = connection.getOutputStream()) {
output.write(json.getBytes(charset));
}
InputStream response = connection.getInputStream();
try (OutputStream output = new FileOutputStream(file)) {
input.transferTo(output);
} catch (IOException ioException) {
ioException.printStackTrace();
}
something like that^
yes
alright, thanks, Ill try that now
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.