在进行 api 调用时获取 { "status" :100, "errormsg" : "Failed to parse text in form param" }



我正在尝试使用下面的代码进行api调用

"

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
//this is where the error is beign thrown
RequestBody body = RequestBody.create(mediaType, "text="+this.body);
Request request = new Request.Builder()
.url("https://text-sentiment.p.rapidapi.com/analyze")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.addHeader("x-rapidapi-key", "API Key")
.addHeader("x-rapidapi-host", "Host")
.build();
client.newCall(request).enqueue(new Callback() {

"

但是当我运行它时,我得到"{"status":100,"errormsg"; "Failed to parse text in form parameter "} ">

这只发生在我尝试使用更大的字符串进行调用时,当应用较小的字符串时,我得到了我需要的结果。

有趣!我期待你在RapidAPI Hub上使用文本情感分析方法API。它对我来说工作得很好,甚至对于大弦也是如此。通常100状态码表示客户端在服务器根据请求报头拒绝请求时避免通过网络发送大量数据。

它现在应该可以工作了。你可以再查一遍。你可以发送你的查询到支持团队的RapidAPI,如果在这种情况下,它仍然不能为你工作。

最新更新