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

18 Replies, 1111 Views

Here's a quick curl post example for ya:

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

You gotta include the `-H` flag for headers (JSON needs it) and `-d` for the data.

If you're still getting 400s, check if the endpoint needs auth—maybe add `-H "Authorization: Bearer YOUR_TOKEN"`.

Messages In This Thread



Users browsing this thread: 1 Guest(s)