Need a simple curl POST example – can anyone share a quick snippet? or Struggling with a curl POST example – any

24 Replies, 1619 Views

"Hey folks,

Struggling to get a curl POST example working for an API test. Every time I try, I either get a 400 error or the server just ignores my data.

Can someone share a quick snippet for a basic curl POST example with JSON data? Like, the simplest one possible—just need to send `{"name": "test"}` to `https://example.com/api`.

I’ve tried a bunch of flags, but maybe I’m missing something obvious.

Also, how do you usually format the headers? Do you always need `-H 'Content-Type: application/json'`?

Thanks in advance!

(PS: If you’ve got a better curl POST example for beginners, I’m all ears.)"

Messages In This Thread
Need a simple curl POST example – can anyone share a quick snippet? or Struggling with a curl POST example – any - by - 03-04-2024, 06:05 AM



Users browsing this thread: 1 Guest(s)