Having trouble with a curl POST request? Need help sending data correctly? Alternatively: How do I pr

14 Replies, 1539 Views

Yo, had the same problem last week! Turns out my JSON was valid but the server expected the data to be URL-encoded. Weird, right?

Try this:
```bash
curl -X POST https://example.com/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "param1=value1¶m2=value2"
```

If that works, then the server’s just picky. For debugging, `-i` shows response headers, which might give a clue.

Also, Postman is great for testing before translating to curl post requests.

Messages In This Thread



Users browsing this thread: 1 Guest(s)