Postmark problem API call , break my calls

Hello everyone,

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:

  1. png → Shows the JSON structure.
  2. png → Displays an array within the JSON used for email creation. I suspect the problem might stem from here.
  3. png → Illustrates the ‘selection’ format as text.
  4. png → Shows the JSON validated as correct on JSONLint.
  5. 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 ?

Si ce n’est simplement pas vide, mais qu’il y a du texte accepté, alors oui ça va.
As-tu tenté d’envoyer sur requestbin?

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é ^^

Si le JSON est valide, alors c’est possiblement un problème du côté Postmark. Est-ce que la même requête fonctionne dans postman?

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:

  1. Extract the “body” property from the RequestBin output
  2. 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é

I recommend reading this: Changes to Email API validation – Action may be required | Postmark

Since you’re getting a 422 error it’s related to their most recent changes

1 Like

Thank i read it … but didn help ^^thanks

What does it look like you’re passing through in your Bubble logs?

There can potentially be something you’re passing through that violates their rules causing the 422 error

I have this (see attached) and if you test the json it works on jsonlint :
thing is,

{ “nom”: “”, “prenom”: “”, “commercial”: “g”, “diagxylophagesdetails”:, “appreciation”: “Correct”, “agedubien”: “Non renseigné”, “agederniertraitement”: “Non renseigné”, “necessitetraitement”: “Non renseigné”,“traitementconseille”: “Non renseigné”, “methodeconseillee”: “Non renseigné”, “delaiconseille”: “Non renseigné”, “constatationdiverses”:“Non renseigné”, “isolation”: “Non renseigné”, “etancheite”: “Non renseigné”, “ventilation”: “Non renseigné”, “acceptation”: null, “a”: “Non renseigné”, “le”: “Non renseigné” }

nom … tu ne peux pas envoyer une valeur vide "". Idem prénom

Mais comment tu le formates du coup ?

Non pardon avec le format as text comme fait ci dessus … C’était pour l’exemple le screen pas sur que ce soit ça je vais voir merci

null. Valeur Is empty:format as text (yes=null,no=valeur:formatted as json safe)

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
Screen Shot 2023-11-18 at 04.33.04
Screen Shot 2023-11-18 at 04.32.58

Tu as la partie format as text de selection?

Screen Shot 2023-11-18 at 04.38.19
voici !