How to properly use curl POST JSON in my API requests? or What's the correct syntax for a curl POST J

14 Replies, 1625 Views

Dude, Windows cmd is the worst for curl post json. Powershell might save you here. Try this:

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

Or just use WSL if you can.

Pro tip: Add `-v` to your curl command to see the raw request/response. Might show why the server’s ignoring your JSON.

Messages In This Thread



Users browsing this thread: 1 Guest(s)