Having trouble with curl sending JSON? Need help with the correct syntax and headers!

7 Replies, 1932 Views

Hey there! Your curl sending json syntax looks fine to me, but the issue might be with the server-side validation. Some APIs are strict about trailing commas or extra spaces in the JSON payload.

Try this:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://example.com/api -v
```
The `-v` flag will give you verbose output, which might help you see what’s going wrong.

Also, check the API docs to see if they require any specific headers or if the endpoint is case-sensitive.

Messages In This Thread



Users browsing this thread: 2 Guest(s)