0

I am using Apache httpclients. The api I am calling use an array as the payload. I am trying to figure out a way to send post request with an array as payload. Thanks. The curl is like

curl -N -i -X 'POST' https://myurl -d '{"data":["2021-11-01T00:00:00Z/2021-11-02T00:00:00Z"]}' -H "Content-Type:application/json"
Valijon
  • 11,382
  • 4
  • 32
  • 62
Mike Wang
  • 69
  • 2
  • 9
  • 1
    It looks like your payload is JSON. As such, the issue isn't really "sending an array from a Java HTTP client", but rather "how to POST a JSON array to the client". Look [here](https://stackoverflow.com/a/12060103/421195) or [here](https://www.baeldung.com/httpclient-post-http-request). Look [here](https://www.oracle.com/technical-resources/articles/java/json.html) for details on serializing JSON from Java 8 or higher – paulsm4 Nov 03 '21 at 23:26

0 Answers0