You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

将cURL命令导入Postman时遇报错,该如何修复?

解决Postman导入cURL命令的错误问题

错误原因

你导入的内容同时包含了cURL命令和接口返回的JSON响应,Postman会将整个内容当作cURL命令解析,而JSON部分没有对应的命令选项前缀,从而触发报错:

Error while importing Curl: Only the URL can be provided without an option preceding it.All other inputs must be specified via options.

解决步骤

  1. 提取纯cURL命令
    从你提供的内容中,只保留cURL命令部分,删除后面的JSON响应内容,正确的纯命令如下:

    curl -X POST -H "Authorization: Bearer $API_KEY" https://api.astria.ai/tunes \
              -F tune[callback]="http://localhost/" \
              -F tune[title]="my portrait" \
              -F tune[branch]="fast" \
              -F tune[name]=person \
              -F "tune[images][]=@1.jpg" \
              -F "tune[images][]=@2.jpg" \
              -F "tune[images][]=@3.jpg" \
              -F "tune[images][]=@4.jpg"
    
  2. 导入到Postman

    • 打开Postman,点击左上角的「Import」按钮
    • 在弹出的导入窗口中选择「Raw text」选项
    • 粘贴上面的纯cURL命令,点击「Continue」
    • 确认请求信息无误后,点击「Import」完成导入

后续调整(可选)

  • 替换API密钥:在Postman的请求「Headers」标签中,找到Authorization头,将$API_KEY替换为你的真实密钥
  • 替换图片文件:在请求「Body」标签的form-data区域,找到tune[images][]字段,点击右侧的「Select Files」按钮,选择本地对应的图片文件

内容的提问来源于stack exchange,提问作者Hasan Altay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 08:31:02