首页 > 解决方案 > "status_code": 422, "error_code": "REQUEST_PARAM_PARSE", "detail": "'data' 参数必须是一个列表"

问题描述

我正在使用 HTTP 请求向导设置对 MonkeyLearn 的 POST 请求。此端点需要请求正文(或有效负载正文)中的 JSON。它必须是具有 data 属性的对象和要分类为值的文本列表。例如:

{
  "data": [
    "This is the best sentiment analysis tool ever!!!",
  ]
}

所以,在HTTP请求向导中,我在Parameters下设置了:Name:dataValue:“这是最好的情感分析工具evert!!!” 类型:GetorPost

但是,在预览响应中,我得到:

{
  "status_code": 422,
  "error_code": "REQUEST_PARAM_PARSE",
  "detail": "The ‘data’ parameter must be a list"
}

我无法弄清楚端点期望什么列表?

标签: jsonmonkeylearn

解决方案


我不熟悉“HTTP 请求向导”,也找不到它。但是从您所写的内容可以清楚地看出,您发送的是一个字符串而不是字符串数组。你的价值应该是这样的:Value: [ "This is the best sentiment analysis tool evert!!!" ]


推荐阅读