summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-01-21 10:19:23 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-21 10:51:36 +0100
commitbdc08cdfce84145227fef5d2f0b232d6662367b5 (patch)
tree2c4fe454ae27e1294a846029d23a21275b30c406
parent69772d7a3aa5b6356cceeeb515895936e4bf5aff (diff)
downloadcurl-bdc08cdfce84145227fef5d2f0b232d6662367b5.tar.gz
cmdline-opts/json.d: document --json
-rw-r--r--docs/cmdline-opts/Makefile.inc3
-rw-r--r--docs/cmdline-opts/json.d29
-rw-r--r--docs/options-in-versions1
3 files changed, 32 insertions, 1 deletions
diff --git a/docs/cmdline-opts/Makefile.inc b/docs/cmdline-opts/Makefile.inc
index f8b571127..afa3d7931 100644
--- a/docs/cmdline-opts/Makefile.inc
+++ b/docs/cmdline-opts/Makefile.inc
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@@ -111,6 +111,7 @@ DPAGES = \
interface.d \
ipv4.d \
ipv6.d \
+ json.d \
junk-session-cookies.d \
keepalive-time.d \
key-type.d \
diff --git a/docs/cmdline-opts/json.d b/docs/cmdline-opts/json.d
new file mode 100644
index 000000000..6d18d49ca
--- /dev/null
+++ b/docs/cmdline-opts/json.d
@@ -0,0 +1,29 @@
+Long: json
+Arg: <data>
+Help: HTTP POST JSON
+Protocols: HTTP
+See-also: data-binary data-raw
+Mutexed: form head upload-file
+Category: http post upload
+Example: --json '{ "drink": "coffe" }' $URL
+Example: --json '{ "drink":' --json ' "coffe" }' $URL
+Example: --json @prepared $URL
+Example: --json @- $URL < json.txt
+Added: 7.82.0
+---
+Sends the specified JSON data in a POST request to the HTTP server. This makes
+curl pass the data to the server using the content-type application/json.
+\&--json works like an alias for
+
+ --data [arg] --header "Content-Type: application/json"
+
+There is **no verification** that the passed in data is actual JSON or that
+the syntax is correct.
+
+If this option is used more than once on the same command line, the additional
+data pieces will be concatenated to the previous before sending.
+
+If you start the data with the letter @, the rest should be a file name to
+read the data from, or a single dash (-) if you want curl to read the data
+from stdin. Posting data from a file named \&'foobar' would thus be done with
+--json @foobar and to instead read the data from stdin, use --json @-.
diff --git a/docs/options-in-versions b/docs/options-in-versions
index e75df6e06..5d242b8ff 100644
--- a/docs/options-in-versions
+++ b/docs/options-in-versions
@@ -99,6 +99,7 @@
--interface 7.3
--ipv4 (-4) 7.10.8
--ipv6 (-6) 7.10.8
+--json 7.82.0
--junk-session-cookies (-j) 7.9.7
--keepalive-time 7.18.0
--key 7.9.3