The HTTP module shows a 400 Bad Request error. Most likely, the problem is in the quotes and line breaks in the body of the JSON request.
Using the PDF.co module, convert from PDF, I convert to text from a PDF file. Then, using the HTTP module, Make a request, and a request to OpenAI, I want to make a summary from the PDF file. It returns a 400 Bad Request error. If, after the PDF.co module, convert from PDF, I install the Telegram Bot module, Send a text messege, then normal text from PDF comes to Telegram and there is no error. The error appears only when you transfer data from the PDF.co module, convert from PDF, to the HTTP module, Make a request, and a request to OpenAI. Probably, the whole point is that through item I insert the content of the PDF file into the text of the JSON request and it contains quotes and “live” line breaks. Please tell me how to make text escaping in Make or how to automatically replace these quotes and line breaks with correct ones? Or maybe you can suggest an article or/and a lesson at the Academy….
It would be helpful to see an example of the text you are referring to in order to confirm, but perhaps what you need is the Text parser tool in combination with regex.
Most of the time, you cannot directly map variables containing text content into another JSON string without escaping them, as the variable might contain characters that have a special meaning in JSON.
Special characters in strings needs to be specified (escaped) as a “literal” character (instead of a special metacharacter), otherwise they make the whole JSON invalid when you map the variable value when creating another JSON string.
You can escape string variables by passing the text into the JSON “Transform to JSON” module —
Transforms any object to JSON.
Then, you can map the output of the “Transform to JSON” module into your JSON string. (Do note that when using the “Transform to JSON” module, the output should already contain the double quotes " " around your text, so when you map this output into your JSON, you should not need to wrap another pair of double quotes around it.)
Alternatively, you can use the built-in function replace to replace those special characters with their escaped versions, as discussed here.
1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.
2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.
This marks the topic as solved, so that:
others can save time when catching up with the latest activity here, and
allows others to quickly jump to the solution if they come across the same problem
To do this, simply click the checkbox at the bottom of the post that answers your question:
3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!
Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —