Need a simple curl post example – how do I send data with curl? or Can someone share a basic curl pos

17 Replies, 935 Views

Dude, you’re missing the headers! Here’s how I do it:

```
curl -X POST https://example.com/api \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"name": "test"}'
```

Sometimes APIs are picky about `Accept` headers too.

If you’re on Windows, watch out for quotes—use double quotes outside and escape the JSON ones.

Messages In This Thread



Users browsing this thread: 1 Guest(s)