How do I send a POST request from curl correctly? or What's the best way to make a POST request from

22 Replies, 1511 Views

Hey! I had the same issue with a post request from curl last week. Turns out I was missing quotes around the JSON data. Try this:

```bash
curl -X POST https://example.com/api -H "Content-Type: application/json" -d '{"key":"value"}'
```

Also, for auth, `-u` works, but if it's a token, use `-H "Authorization: Bearer YOUR_TOKEN"`.

Messages In This Thread



Users browsing this thread: 1 Guest(s)