For example you are doing a little API with music albums your curl (for Mac) for inserting a record looks like this:
$ curl http://localhost:8080/albums \ --include \ --header "Content-Type: application/json" \ --request "POST" \ --data '{"id": "4","title": "The Modern Sound of Betty Carter","artist": "Betty Carter","price": 49.99}'But boom not working for Windows because of the following.
- The not-yet-end-of-commmand character for Windows is not \, it is ^.
- Don't use single quotes. Json double quotes need to be escaped.
So the command above to run for above is
curl http://localhost:8080/albums ^ --include ^ --header "Content-Type: application/json" ^ --request "POST" ^ --data "{\"id\": \"4\",\"title\": \"The Modern Sound of Betty Carter\",\"artist\": \"Betty Carter\",\"price\": 49.99}"
No comments:
Post a Comment