0

I'm trying to make an api call using the below code

'''

    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() {

'''

But when I run it I get "{"status":100,"errormsg":"Failed to parse text in form param"} "

This only happens when I try to make a call with a bigger string, when smaller strings are applied I get the results i need to have.

1 Answers1

-1

Interesting! I'm expecting you're using Text Sentiment Analysis Method API on RapidAPI Hub. It is working fine for me even for the large strings as well. Generally 100 status code indicate clients to avoid sending large amounts of data over the network when the server, based on the request headers, intends to reject the request.

It should be working now. You can check again. You can send your query to support team of RapidAPI if, in case, it is still not working for you.

Pratham
  • 497
  • 3
  • 7