ContactsClient::create() accepts a union of three mutually-exclusive request types:
public function create(
CreateContactRequestWithEmail
|CreateContactRequestWithExternalId
|CreateContactRequestWithRole $request,
?array $options = null
): ContactsCreateResponse
Each type carries only one of the three identifiers. There is no request class that lets you create a contact with all three populated in the same POST /contacts body.
The REST endpoint itself accepts them together, so this is a property of the SDK's generated types, not the API.
The forced workaround I have to use is this two-step create-then-update:
- POST /contacts with email only via CreateContactRequestWithEmail
- PATCH /contacts/{id} with external_id + role + everything else
Solution: a request that merges the different bodies:
$request = new CreateContactRequest([
'email' => 'jane@example.com',
'externalId' => 'app-user-1234',
'role' => 'user',
'name' => 'Jane',
]);
$client->contacts->create($request);
This was possible in the previous v4 sdk.
I use the latest sdk version.
ContactsClient::create()accepts a union of three mutually-exclusive request types:Each type carries only one of the three identifiers. There is no request class that lets you create a contact with all three populated in the same POST /contacts body.
The REST endpoint itself accepts them together, so this is a property of the SDK's generated types, not the API.
The forced workaround I have to use is this two-step create-then-update:
Solution: a request that merges the different bodies:
This was possible in the previous v4 sdk.
I use the latest sdk version.