How to properly send curl post data with headers and parameters? or What's the best way to format cur

18 Replies, 1195 Views

Hey! Had the same issue last week. Turns out some servers freak out if the JSON isn't perfectly formatted. Try using `-d @filename.json` instead of inline JSON. Also, check if the server expects escaped quotes.

For auth headers, this works for me:
```bash
curl -X POST https://example.com/api -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_TOKEN" -d '{"key":"value"}'
```
Hope that helps!

Messages In This Thread



Users browsing this thread: 1 Guest(s)