Sending POST requests with curl
This commit is contained in:
parent
4fdfe301d3
commit
f7f94e1bfc
29
source/_notes/16.md
Normal file
29
source/_notes/16.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
title: "Sending POST requests with curl"
|
||||||
|
date: 2024-08-27 20:11:37
|
||||||
|
tags: [Linux, Command-Line, curl]
|
||||||
|
links:
|
||||||
|
- https://stackoverflow.com/questions/7172784/how-do-i-post-json-data-with-curl
|
||||||
|
- https://linuxize.com/post/curl-post-request
|
||||||
|
---
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl --header "Content-Type: application/json" \
|
||||||
|
--insecure \
|
||||||
|
--data '{"foo": "bar"}' \
|
||||||
|
https://example.docker.localhost/webhook
|
||||||
|
```
|
||||||
|
|
||||||
|
`--request POST` is implied if `--data` is passed.
|
||||||
|
|
||||||
|
`--insecure` skips SSL validation, e.g. if using a self-signed certificate.
|
||||||
|
|
||||||
|
Also, from `man curl`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
--json works as a shortcut for passing on these three options:
|
||||||
|
|
||||||
|
--data [arg]
|
||||||
|
--header "Content-Type: application/json"
|
||||||
|
--header "Accept: application/json"
|
||||||
|
```
|
Loading…
Reference in a new issue