Home > Enterprise >  Converting Postman to Curl windows
Converting Postman to Curl windows

Time:06-03

I looked at all previous answers on this subject but just can't get my POST request to work in cURL windows although it works perfectly in PostMan. I exported the code using </> and tried several combinations of export parameters... any help would greatly appreciated!

Here's my cURL code:

curl -L -X POST "https://timingserver.net/api/bridge/generic" -H "cache-control: no-cache" -H "connection: close" -H "content-type: application/json" --data-raw "{
\"username\":\"myusername\",
\"password\":\"mypassword\",
\"event\":\"demo\",
\"checkpoint\":12,
\"detections\":[{\"bib\":100, \"dt\":\"2022-01-12T13:09:23.045\"},
{\"bib\":101, \"dt\":\"2022-01-12T13:09:23.045\"},
{\"bib\":102, \"dt\":\"2022-01-12T13:09:23.045\"},
{\"bib\":199, \"dt\":\"2022-01-12T13:10:23.045\"}]
}"

Getting several errors in the same execution: Code 400, not recognized as an internal or external command... cannot find the path specified...

CodePudding user response:

You need to remove the linebreaks:

curl -L -X POST "https://timingserver.net/api/bridge/generic" -H "cache-control: no-cache" -H "connection: close" -H "content-type: application/json" --data-raw "{ \"username\":\"myusername\", \"password\":\"mypassword\", \"event\":\"demo\", \"checkpoint\":12, \"detections\":[{\"bib\":100, \"dt\":\"2022-01-12T13:09:23.045\"}, {\"bib\":101, \"dt\":\"2022-01-12T13:09:23.045\"}, {\"bib\":102, \"dt\":\"2022-01-12T13:09:23.045\"}, {\"bib\":199, \"dt\":\"2022-01-12T13:10:23.045\"}] }"
  • Related