How to properly send a curl post request with JSON data? or Why is my curl post request returning a 4

14 Replies, 1536 Views

Thanks everyone! Adding `-H "Content-Type: application/json"` fixed it—turns out the server was super strict about headers.

I also tried `-v` and saw the server was expecting `Accept: application/json` too. Weird, but it works now.

Quick follow-up: How do I handle auth headers? Like, if I need to add a token, do I just slap on `-H "Authorization: Bearer token"`? Or is there a cleaner way?

Messages In This Thread



Users browsing this thread: 1 Guest(s)