Currently integrating our own mailing list subscription flows, ie, when someone places an order and subscribes then opt-in-verifies as part of it, with Klaviyo.
I’m using https://a.klaviyo.com/api/v2/list/{list_id}/members for this, platform is a LAMP server, I’m sending requests using PHP’s curl library. It’s a custom ecommerce solution.
The request auths OK, but I keep getting a {"detail":"profiles is a required parameter."} response.
Similar requests have not been a problem.
Here’s the payload:
$data = (object) array( 'profiles' => array( 0 => (object) array('email' => $email_to_sub) ));$jsonObj = json_encode($data);
...and then $jsonObj is set as the ‘data’ field for CURLOPT_POSTFIELDS, after being url encoded, the exact same method that works just fine for several other Klaviyo API requests such as tracking orders.
I have tried variations on this, such as passing the array to CURLOP_POSTFIELDS with ‘profiles’ as the key. Still no luck.
Has anyone had a similar problem?
Many thanks.