How do I send a post request from curl? Need help with the syntax! or What’s the correct way to make

16 Replies, 1879 Views

Here’s a working example of a post request from curl I use all the time:

```
curl -X POST https://example.com/api \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"username":"foo", "password":"bar"}'
```

If it’s still not working, try adding `-v` to see verbose output—it’ll show you the raw request and response. Super helpful for debugging!

Messages In This Thread



Users browsing this thread: 1 Guest(s)