From b8c90e893c38e411d8255b9901539f89503a5cbd Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 14 Sep 2024 13:39:01 +0100 Subject: [PATCH] POSTing data from a JSON file --- source/_notes/24.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 source/_notes/24.md diff --git a/source/_notes/24.md b/source/_notes/24.md new file mode 100644 index 0000000..dcb3674 --- /dev/null +++ b/source/_notes/24.md @@ -0,0 +1,16 @@ +--- +title: POSTing data from a JSON file +date: 2024-09-14 13:39:01 +tags: [Linux, curl] +related: + - Sending POST requests with curl +use: [notes] +--- + +When sending JSON data in a POST request, instead of writing it inline with the `--data` or `--json` option, a filename can be entered - prefixed with an `@` symbol. + +For example, to POST the data from a data.json file: + +```shell +curl --insecure --json @data.json https://mysite.com/webhook +```