"Help! Can't get my curl post a url command to work – what am I missing?"
Hey folks,
Trying to curl post a url but keep getting errors. My syntax looks like this:
```
curl -X POST https://example.com/api -d '{"key":"value"}'
```
But it’s either throwing a 400 or just ignoring the data.
Am I missing headers? Do I need `-H "Content-Type: application/json"` or something? Also, should I use `--data` instead of `-d`?
Kinda new to this, so a step-by-step breakdown would be *chef’s kiss*.
Bonus Q: Any best practices for curl post a url? Like, should I always include certain headers?
Thanks in advance! 🙏
(PS: If you’ve got a working example, pls share!)
Hey folks,
Trying to curl post a url but keep getting errors. My syntax looks like this:
```
curl -X POST https://example.com/api -d '{"key":"value"}'
```
But it’s either throwing a 400 or just ignoring the data.
Am I missing headers? Do I need `-H "Content-Type: application/json"` or something? Also, should I use `--data` instead of `-d`?
Kinda new to this, so a step-by-step breakdown would be *chef’s kiss*.
Bonus Q: Any best practices for curl post a url? Like, should I always include certain headers?
Thanks in advance! 🙏
(PS: If you’ve got a working example, pls share!)
