Error with Content-Type as text/plain

I’m making a post request that returns plain text in an API workflow. I use Content-Type: text/plain header, and it returns this:

Are you suggesting that the error has something to do with Content-Type: text/plain header?
From the message it looks like the request is missing data.

Yes, cause when I don’t add that header, it works fine

I’m missing the point of your question.

Are you making a request to an exposed API workflow and adding Content-Type: text/plain header to the request? If yes you get the error because the content of the request should not be text/plain and it gets interpreted in the wrong way, so the parameters are missing.

Are you making a request to an external API from inside a workflow and you get the error? If yes can you share details aboit the request?

So the request is from a Discord bot, and the only think in the workflow is returning the data using data that was sent through the request body.

However, when I dont add the Content-Type as text/plain, the bot gives me an invalid json error

Well, it’s not clear what you are doing. Feel free to elaborate with more details

So I have a bot command that retrieves user information from my database. It sends a POST request to an API workflow, and the only action in that workflow is “Return data from API” and returns a bunch of user information in the response body.

if you send json content to the API workflow but add the wrong content-type header to the request you will probably get a wrong parsing of the request body. I think this is why you get the missing parameter error.
What is the error you get from the bot? what is the bot expecting as response?

Ok sorry, I meant Accept header. I always get those 2 confused, i’m sorry. So i put accept text/plain and get MISSING_DATA error with bubble, but when I dont, I get this error with the bot: `Bot has started at Sunday, Feb 12, 2023, 11:02:37 AM

Multiple Bot Owners Extension Loaded!
Applied Header: Authorization: Bearer MY_TOKEN
?
? C:\Users\ryaav\OneDrive\Desktop\Bots\CloudifyBOT (PUBLIC)\node_modules\node-fetch\lib\index.js:273
? return Body.Promise.reject(new FetchError(invalid json response body at ${_this2.url} reason: ${err.message}, ‘invalid-json’));
? ^
?
? FetchError: invalid json response body at https://cloudifyrms.com/version-test/api/1.1/wf/getuser_bot reason: Unexpected token s in JSON at position 0
? at C:\Users\ryaav\OneDrive\Desktop\Bots\CloudifyBOT (PUBLIC)\node_modules\node-fetch\lib\index.js:273:32
? at processTicksAndRejections (node:internal/process/task_queues:96:5)
? at async Object.action [as Send Json to WebAPI] (C:\Users\ryaav\OneDrive\Desktop\Bots\CloudifyBOT (PUBLIC)\actions\send_json_to_webapi_MOD.js:233:26) {
? type: ‘invalid-json’
? }
?
? Node.js v17.4.0
?`

If the bot expects a json response just return json from the API workflow

I tried that, but there are 38 actions parsing the data so it times out.


image

So you have a problem with the backend that runs your bot.
Have you tried sending less data?

So i’m not sure why, but i think it was the command itself. When I created a new one, it worked perfectly fine. Thank you so much for ur help!