gpt4 book ai didi

postman - 通过 Postman 对 Strapi 进行 Post 操作的问题

转载 作者:行者123 更新时间:2023-12-05 09:28:41 29 4
gpt4 key购买 nike

问题是我无法使用 Postman 应用执行 PUT 或 POST。但是删除是可能的。是的,我为公共(public)用户启用了所有操作。

GET请求结果如下:

{
"data": [
{
"id": 2,
"attributes": {
"title": "23123",
"game": "1231",
"players": "2312313",
"createdAt": "2022-02-19T16:36:34.221Z",
"updatedAt": "2022-02-19T16:36:34.971Z"
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 1
}
}
}

这是我的 POST 请求条目: enter image description here

最后在这里请求 POST 后是结果:

{
"data": null,
"error": {
"status": 400,
"name": "ValidationError",
"message": "Missing \"data\" payload in the request body",
"details": {}
}
}

问题是什么?

最佳答案

我终于找到了解决方案。你需要将 Body 放入原始并将其设置为 Json!默认为文本。

和 POST 示例是:

 {

"data": {
"title": "Hello",
"relation": 2,
"relations": [2, 4]
}
}

关于postman - 通过 Postman 对 Strapi 进行 Post 操作的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71187083/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com