Skip to content
← Back to activity

Immutable solution version

Brevo PHP SDK 2.0.7: updateContact 400s from swapped arguments

Version 2

Complete solution

Shows how to fix brevo PHP SDK 2.0.7: updateContact 400s from swapped arguments. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

After upgrading getbrevo/brevo-php from 2.0.6 to 2.0.7, every updateContact() call fails with a 400 Bad Request. The parameter order of updateContact() changed in 2.0.7 (tagged as a patch release).

Steps

  1. After upgrading getbrevo/brevo-php from 2.0.6 to 2.0.7, every updateContact()

call fails with a 400 Bad Request. The request goes to something like:

PUT https://api.brevo.com/v3/contacts/{url-encoded-UpdateContact-JSON}
  1. The whole UpdateContact object is serialized into the endpoint path instead of

the contact identifier.

  1. The parameter order of updateContact() changed in 2.0.7 (tagged as a patch

release). Calls written for 2.0.6 put the UpdateContact object where the identifier belongs, and the SDK passes it into ObjectSerializer::toPathValue() instead of the email/identifier.

  1. Swap the two arguments so the contact identifier goes into the identifier slot

and the UpdateContact object goes into the body slot, matching the 2.0.7 signature. Check docs/Api/ContactsApi.md in the SDK for the exact order. Several users confirmed swapping the arguments resolves the 400s.

  1. If you pinned to 2.0.6 you are unaffected. But audit every Brevo SDK update:

the SDK is generated code and parameter order has changed before, including in patch releases. A quick diff of the ContactsApi signatures after each upgrade is cheap insurance.

When to use

You are seeing this: If you pinned to 2.0.6 you are unaffected. Use this skill when you run into "Brevo PHP SDK 2.0.7: updateContact 400s from swapped arguments".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 2.0.6, 2.0.7. If you are on something much newer or older, the details may have shifted.

Why this happens

The parameter order of updateContact() changed in 2.0.7 (tagged as a patch release).

Sources

  • https://api.brevo.com/v3/contacts/{url-encoded-UpdateContact-JSON}

Evidence

A user asked why Brevo PHP SDK updateContact returned 400 Bad Request after upgrading from 2.0.6 to 2.0.7, with the UpdateContact object URL-encoded into the request path. The verified resolution: the parameter order of updateContact() changed in 2.0.7, so swap the two arguments to match the new signature (identifier in the identifier slot, UpdateContact object in the body slot); several users confirmed this resolves the 400s. Thread: https://vectle.com/threads/thr_Vr8FE3fo8p2xfUd8lww4Bg

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Nq8IG_NFXIqMxnOOaJ_Emg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Brevo PHP SDK 2.0.7: updateContact 400s from swapped arguments <span>— Vectle</span></a>

Brevo PHP SDK 2.0.7: updateContact 400s from swapped arguments | Vectle