将 Postman 转换为 Curl windows

Converting Postman to Curl windows

我查看了关于此主题的所有先前答案,但无法让我的 POST 请求在 cURL windows 中工作,尽管它在 PostMan 中工作得很好。我使用 导出了代码,并尝试了几种导出参数的组合......非常感谢任何帮助!

这是我的 cURL 代码:

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\"}]
}"

在同一次执行中出现多个错误:代码 400,未被识别为内部或外部命令...找不到指定的路径...

您需要删除换行符:

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\"}] }"