我正在使用邮差测试一些Curl请求到API服务器。API开发人员给了我们curl命令,但我不能从邮递员发送它。如何向邮差提出这样的要求?

curl -X POST "https://api-server.com/API/index.php/member/signin" -d "{"description":"","phone":"","lastname":"","app_version":"2.6.2","firstname":"","password":"my_pass","city":"","apikey":"213","lang":"fr","platform":"1","email":"email@example.com","pseudo":"example"}"

--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="userfile"; filename="profil.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: binary

<ffd8ffe0 00104a46 49460001 01010048 ... a00fffd9>

—0xKhTmLbOuNdArY—

当前回答

我完全转向失眠应用程序解决了这个问题。

打开失眠应用程序,并将CURL请求粘贴到请求页面的URL部分。 这接受CURL与小差异和CURL从chrome复制作为CRUL命令也。

其他回答

1)在url输入框中输入https://api-server.com/API/index.php/member/signin,在下拉框中选择POST

2)在Headers页签中输入:

内容类型:图像/ jpeg

Content-Transfer-Encoding:二进制

3)在Body选项卡中,选择raw单选按钮并写入:

{“描述”:“”,“电话”:“”,“姓”:“”,“app_version”:“2.6.2”、“firstname”:“”,“密码”:“my_pass”、“城市”:“”,“apikey”:“213”,“朗”:“fr”、“平台”:“1”,“电子邮件”:“email@example.com”、“伪”:“例子”}

选择form-data单选按钮并写入:

key = name Value = userfile选择文本 选择文件并上传你的profile .jpg

In addition to the answer
1. Open POSTMAN
2. Click on "import" tab on the upper left side.
3. Select the Raw Text option and paste your cURL command.
4. Hit import and you will have the command in your Postman builder!
5. If -u admin:admin are not imported, just go to the Authorization 
   tab, select Basic Auth -> enter the user name eg admin and password eg admin.
This will automatically generate Authorization header based on Base64 encoder

一个更简单的方法是:

开放的邮递员 点击左上角的“导入”标签。 选择Raw Text选项并粘贴cURL命令。 点击导入,您将在您的邮差构建器中拥有命令! 单击Send发送命令

1.从左上角导入 2.转到原始文本并粘贴代码 3.导入它 4.您可以确认请求URL、参数和头是否正确导入。

我完全转向失眠应用程序解决了这个问题。

打开失眠应用程序,并将CURL请求粘贴到请求页面的URL部分。 这接受CURL与小差异和CURL从chrome复制作为CRUL命令也。