code_dude
code_dude

Reputation: 1111

How do I fix CURL error "Could not resolve host"?

I am trying to make a POST request on windows console with some json data and I get this error:

curl: (6) Could not resolve host: John,
curl: (6) Could not resolve host: lName
curl: (6) Could not resolve host: Doe,
curl: (6) Could not resolve host: phone
curl: (6) Could not resolve host: 0123456789,
curl: (6) Could not resolve host: passwd
curl: (6) Could not resolve host: myPassword,
curl: (6) Could not resolve host: tosAgm
curl: (3) [globbing] unmatched close brace/bracket in column 5
{}

The request looks like this:

curl -d '{"fName": "John", "lName": "Doe", "phone": "0123456789", "passwd": "myPassword", "tosAgm": "true"}' -H "Content-Type: application/json" -X POST http://localhost:3000/users

After doing some research I found that the request is correct, so why am I getting this error? How to fix it?

Upvotes: 0

Views: 6512

Answers (1)

Raymi
Raymi

Reputation: 46

I think you need to escape double-quotes

curl -d '{\"fName\": \"John\", ...

Upvotes: 1

Related Questions