[英]Getting “Bad Request” for Postman API
I simply took an example from Postman API Documentation for Create Collection and removed the extra request outside the folder.我只是从Postman API Documentation for Create Collection 中举了一个例子,并删除了文件夹外的额外请求。
My intention is to create just a folder with 1 request in it.我的目的是只创建一个包含 1 个请求的文件夹。
Here is the request:这是请求:
{
"collection":{
"variables":[
],
"info":{
"name":"Sample Collection",
"description":"This is just a sample collection.",
"schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item":[
{
"name":"This is a folder",
"description":"",
"item":[
{
"name":"Sample POST Request",
"request":{
"url":"echo.getpostman.com/post",
"method":"POST",
"header":[
{
"key":"Content-Type",
"value":"application/json",
"description":""
}
],
"body":{
"mode":"raw",
"raw": "{
\"data\": \"123\"
}"
},
"description":"This is a sample POST Request"
},
"response":[
]
}
]
}
]
}
}
But for this, I am getting "Bad Request" error, what exactly is wrong with my request?但是为此,我收到“错误请求”错误,我的请求到底有什么问题?
EDIT - Here's what it looks like in Postman编辑 - 这是Postman 中的样子
To me, it looks like you're trying to send the whole collection
json file back to that route.对我来说,看起来您正在尝试将整个
collection
json 文件发送回该路由。
The JSON in the request body on the image is what you would import into Postman to get the Sample Collection
folder.图像请求正文中的 JSON 是您将导入 Postman 以获取
Sample Collection
文件夹的内容。 This contains a request called Sample POST Request
这包含一个名为
Sample POST Request
Copy the request body JSON and save it as a .json
file - Then import this using the Import
feature in the top left on the application.复制请求正文 JSON 并将其保存为
.json
文件 - 然后使用应用程序左上角的Import
功能导入它。
This will then create the folder for you in the application with the sample POST request.然后,这将使用示例 POST 请求在应用程序中为您创建文件夹。
If you send it to the echo
URL, you will receive a response telling you that the URL has now changed to https://postman-echo.com/post
- Add this new URL into the address bar and hit Send
.如果您将其发送到
echo
URL,您将收到一个响应,告诉您 URL 现在已更改为https://postman-echo.com/post
- 将此新 URL 添加到地址栏中并点击Send
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.