I’ve been grappling with an issue for several days now and haven’t been able to resolve it. I’m working with four API calls to generate emails, utilizing an API connector and Postmark. Everything was functioning seamlessly until Postmark updated their API to reject improperly formatted JSON.
Despite extensive testing and debugging with tools like RequestBin, JSONLint, and others, my calls appear correct, yet Postmark consistently rejects my POST requests. The errors are type 422 from Postmark, indicating a “Workflow error - The service Postmark - Diagnostic xylophages (test) just returned an error (HTTP 422). Please consult their documentation to ensure your call is set up properly. Raw error: {“ErrorCode”:403,“Message”:“Received valid, but incompatible JSON input.”}”
Debugging this issue is challenging. When I extract the JSON from the logs and test it on JSONLint, it seems valid. I wonder if the problem could be related to the formatting in Bubble, or if the ‘json safe’ format is not functioning correctly.
Additionally, I reached out to Postmark support, and they suggested the issue might not be straightforward to diagnose, hinting at the possibility of unescaped quotes in the JSON.
Your insights or suggestions would be greatly appreciated.
For better clarity, I’ve attached five screenshots:
png → Shows the JSON structure.
png → Displays an array within the JSON used for email creation. I suspect the problem might stem from here.
png → Illustrates the ‘selection’ format as text.
png → Shows the JSON validated as correct on JSONLint.
png → Depicts the error I’m encountering in the logs.
Thanks in advance for your help!
I attached 3 screenshots for your understanding
1.png ==> the example of the json structure
2.png ==> I have an array on this json to create the email so i put this screen, I suspect, the issue can come from this so as per your informaiton
3.png ==> the format ast text of “selection”
4.png ==> The valid json on jsonlint
5.png ==> The error i have on the logs
Test by sending the data to requestbin and inspect your json received.
Do you have an empty field? if yes, this need to be replaced by null.
(example: this value’s is empty:format as text yes= null no = this value:formatted as json-safe)
@Jici Many thanks for your reply
yes, i can have empty fields since some inputs can be empty on the form.
Fort this, i have something like attached to translate on the email null to “non renseigné” do i have to use null ? instead of other terms ?
thanks
Oui j’ai envoyé plusieurs fois sur request bin, et le pire dans tout ça, c’est que le json qui me sort est valide ;(
ils font un changement chez postmark d’API qui a été testé le 16 et pendant ce test tout a craché ^^
Le point très compliqué c’est que je ne peux pas reproduire le bug, puisque leur nouvelle API n’était qu’en test donc je ne peux pas re tester, le support postmark quand je lui dis que ça passe même dans request bin, il me dit " > > > So the problem could possibly be coming from simply copy-pasting the entire RequestBin output, which is valid JSON, but that does not represent the JSON payload being sent in the request - the “body” property in the RequestBin output contains the request body, and it is shown as a string as opposed to the JSON object that was received.
The raw JSON object is what needs to be validated in a tool like JSONLint.
It takes a few steps to extract, but the process is essentially this:
Extract the “body” property from the RequestBin output
The “body” field is a string, so it needs to be converted to a JSON object by:
Removing the newlines (remove \n characters)
Unescaping the quotes (replace " with ")
Once these steps are done, the raw JSON will be revealed and this is what you can run through JSONLint." donc je creuse, mais sans pouvoir réellement tester c’est compliqué
Et si par malheur, il faut enlever la ligne au complet, alors c’est plus complexe un peu car il faut encoder la.ligne entière et mettre la virgule dans le format as text
En fait j’y suis la dessus, c’est juste que pour mon test demandé j’ai pris un autre call (4H32 du matin ici ^^, un peu fatigué)
Je suis quasi persuadé que le probleme vient du formatage de mon array et que c’est ça qu’il n’accepte pas car je viens de réussir pour les autres call à faire fonctionner. Tu as peut être un dernier avis la dessus ??? merci beaucoup @Jici