Hey everyone,
So I’ve been trying to get curl sending json to work, but I’m kinda stuck. I’m pretty sure I’m messing up the syntax or headers or something.
Here’s what I’m doing:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://example.com/api
```
But I keep getting errors like "invalid json" or "bad request." Am I missing something obvious? Like, do I need to escape the quotes or add extra headers?
Also, does it matter if I use single or double quotes around the json data? I’ve seen both in examples, and it’s lowkey confusing.
Any help would be awesome! Thanks in advance, y’all.
P.S. If you’ve got a working example of curl sending json, pls share! 🙏
So I’ve been trying to get curl sending json to work, but I’m kinda stuck. I’m pretty sure I’m messing up the syntax or headers or something.
Here’s what I’m doing:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://example.com/api
```
But I keep getting errors like "invalid json" or "bad request." Am I missing something obvious? Like, do I need to escape the quotes or add extra headers?
Also, does it matter if I use single or double quotes around the json data? I’ve seen both in examples, and it’s lowkey confusing.
Any help would be awesome! Thanks in advance, y’all.
P.S. If you’ve got a working example of curl sending json, pls share! 🙏
