How to properly use curl for sending JSON data? or Having trouble with curl sending JSON? Any tips?[

14 Replies, 1039 Views

lol yeah the header’s a must for curl sending json. But also, some servers freak out if you don’t include `Accept: application/json` too. Try:

```bash
curl -X POST http://example.com/api -H "Content-Type: application/json" -H "Accept: application/json" -d '{"key":"value"}'
```

If it’s still broken, maybe the API’s just bad? ¯\_(ツ)_/¯

Messages In This Thread



Users browsing this thread: 1 Guest(s)