Error 400 via the leadCapture/save2

Maxime_Toiron
Level 1

Error 400 via the leadCapture/save2

Hello,

I have a problem when I call my referral webhook. There is an error 400 with th leadCapture/save2. I have this message :

pastedImage_2.png

Do you have this problem?

Any ideas here?

Thanks

8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: Error 400 via the leadCapture/save2

  formid

is all lower case.

Maxime_Toiron5
Level 1

Re: Error 400 via the leadCapture/save2

Thanks Sandford!

I tried in lower case and I've the same problem:

pastedImage_1.png

Here is my setting for the webhook:

pastedImage_2.png

Thanks

SanfordWhiteman
Level 10 - Community Moderator

Re:  Error 400 via the leadCapture/save2

Actually the whole approach is wrong, now that I'm more awake... /save2 is an x-www-form-urlencoded endpoint.

Steven_Vanderb3
Marketo Employee

Re: Error 400 via the leadCapture/save2

I'd guess your {{my.referralFormID}} token is not resolving with a valid value.

Maxime_Toiron
Level 1

Re: Error 400 via the leadCapture/save2

Thanks Sanford Whiteman‌, but actually what would be the right approach?

Thanks Steven Vanderberg‌. My referral form id works.

SanfordWhiteman
Level 10 - Community Moderator

Re:  Error 400 via the leadCapture/save2

Your POST should be a standard URL-encoded form payload. Not JSON. Just like the client library sends.

Maxime_Toiron
Level 1

Re: Error 400 via the leadCapture/save2

Thanks Sanford Whiteman‌,

But I have already tested Request Token Encoding types and still doesn't work.

SanfordWhiteman
Level 10 - Community Moderator

Re:  Error 400 via the leadCapture/save2

It's not only about the encoding of individual fields.

The forms /save and /save2 endpoints accept form-like POST payloads (i.e. like a query string k=v&k2=v2&k3=v3). You're trying to send JSON. This is totally different.

Format your payload correctly and use Form/Url encoding.