About 1,030,000 results
Open links in new tab
  1. HTTP POST using JSON in Java - Stack Overflow

    I would like to make a simple HTTP POST using JSON in Java. Let's say the URL is www.site.com and it takes in the value {"name":"myname","age":"20"} labeled as 'details' for example.

  2. Posting with Java HttpClient - Baeldung

    Jan 18, 2024 · In this tutorial, we’ll look at the sending POST requests using Java HttpClient. We’ll show how to send both synchronous and asynchronous POST requests, as well as concurrent POST requests. In addition, we’ll check how to add authentication parameters and JSON bodies to POST requests.

  3. Sending HTTP POST Request In Java - Stack Overflow

    Jul 24, 2010 · Sending a POST request is easy in vanilla Java. Starting with a URL, we need t convert it to a URLConnection using url.openConnection();. After that, we need to cast it to a HttpURLConnection, so we can access its setRequestMethod() method to set our method. We finally say that we are going to send data over the connection.

  4. java - How to POST JSON request using Apache HttpClient

    Jul 1, 2016 · You're looking for postMethod.setRequestEntity() with a StringRequestEntity that contains your JSON. Apache HttpClient doesn't know anything about JSON, so you'll need to construct your JSON separately. To do so, I recommend checking out the simple JSON-java library from json.org.

  5. Making a JSON POST Request With HttpURLConnection

    May 11, 2024 · In this tutorial, we’ll demonstrate how to make a JSON POST request using HttpURLConnection. A quick and practical guide to performing basic HTTP requests using Java's built-in HttpUrlConnection. Read more →. Learn how to authenticate HTTP requests using HttpUrlConnection. Read more →.

  6. How do I send a POST request with JSON data using Java 11 …

    Apr 7, 2025 · To send a POST request with JSON data, you can use the HttpClient along with its HttpRequest object. Here’s a step-by-step guide and example: HttpClient is used to send HTTP requests and receive responses. Use the HttpRequest class to set the URI, HTTP method (POST), and add the JSON payload as the request body.

  7. Java HttpClient POST Request Example - Send Form Data - Java

    This Java code sends an HTTP POST request to a RESTful web service and sends a JSON payload in the request body. It then prints the response status code and body to the console.

  8. Send a POST request in Java - restful-api.dev

    To prepare our POST request, we are using the HttpRequest class from Java 11 version. We specify that we want to send exactly a POST request and also we provide the request body which we want to send as part of the POST request.

  9. How to Add JSON to the Body of an HTTP POST Request in Java

    Sending JSON data in the body of an HTTP POST request in Java can be easily achieved using libraries like HttpURLConnection or Apache HttpClient. This guide provides a step-by-step explanation on how to do this.

  10. How to Hit a HTTP POST API using JSON as a Request body in Java

    Nov 3, 2022 · In this blog, we are going to learn about Hitting the HTTP POST API using JSON as a Request body in Java. Let’s create a URL that accepts the data via HTTP POST method. We can’t instantiate HttpURLConnection directly, as it’s an abstract class. To send request content, let’s enable the URLConnection object’s doOutput property to true.

  11. Some results have been removed
Refresh