Monkey Learn API works in Postman - not in Bubble

Hey everyone,
This call works fine in Postman formatted per the API documentation from Monkey learn. I also have it working via the Blockspring connector, but really would like to remove that step if possible.

I repeatedly get an error on the format of the text_list parameter when using the Bubble API connector.

Here is the info from the Monkey Learn API doc:
curl --data ‘{“text_list”: [“some text to test”, “some more text”]}’
-H “Authorization:Token 0b38743f3…”
-H “Content-Type: application/json”
-D -
https://api.monkeylearn.com/v2/classifiers/cl_oFKL5wft/classify/

Here is the info for the API connector

Here is the error:

Code copied from Postman looks like this:
curl -X POST -H “Authorization: Token 0b38743f382ee9edabd8d2c16c7282905f118993” -H “Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW” -H “Cache-Control: no-cache” -H “Postman-Token: 0b0dd12f-43cb-a60a-8bf3-8eeeff5c2ac1” -F “text_list=baseball” “https://api.monkeylearn.com/v2/classifiers/cl_oFKL5wft/classify/

Thanks in advance for any help or ideas.

Have you tried Content-Type: application/json instead of multipart/form-data ?
Usually the authorization header would be setup with the parent API Authentication key, should still work though.
The “text_list” should be in the JSON body, not in a query string.

Good luck!

Hey mishav,
Thanks for the ideas.
I’ve tried application/json and putting “text_list” in the body. Unfortunately, I still get the same error.

You put the below in the body and it didn’t work? Make sure to remove it from the parameters area too.

{
“text_list”: [“some text to test”, “some more text”]
}

Hey romanmg,

I tried adding that to the body (and removing it from the parameter) and now I get a "text_list parameter is missing error.

"

Seems like it isn’t recognizing anything in the body in Bubble the way it does in Postman.

You’re no longer getting the error for expecting a list of items, so its progress.

Looks like the parameter is still active, if you don’t see it in the API call, try recreate the API call. Sometimes the API connector doesn’t delete things correctly.

Or refresh the app editor after making changes to the API connector.

Same issue after completely removing and recreating the call.

try this …

Although Bubble didn’t like the results for me, probably too many nested lists. Can change the Data type to Text, and parse the result yourself, especially if its just one set of results.

Mishav,
Thanks for your help. I tried the call as you show above and it worked for the sandbox, but not the live version. Finally occurred to me that maybe the url needed to end with the / after classify.

I added that to the end and it worked. :slight_smile:

However, I’m having the same problem you mentioned with Bubble not handling the results.

Interesting result.

Time to raise a bug report to Bubble.

Let us know how you do.