How Do I Send a CURL POST Request with Headers and JSON Data? or What’s the Correct Syntax for a CURL

18 Replies, 930 Views

Wild guess: Is your JSON wrapped in single quotes? Some shells eat those. Try:
```bash
curl -X POST https://api.example.com/data -H "Content-Type: application/json" -d "{\"key\": \"value\"}"
```

Or save the JSON to a file and use `-d @data.json`. Less shell drama.

---

Messages In This Thread



Users browsing this thread: 1 Guest(s)